@@ -24,18 +24,17 @@ matrix: |
||
| 24 | 24 |
- env: DOCKER_IMAGE=cantino/huginn DOCKERFILE=docker/multi-process/Dockerfile |
| 25 | 25 |
- env: RSPEC_TASK=spec:features |
| 26 | 26 |
include: |
| 27 |
- - rvm: 2.3.0 |
|
| 27 |
+ - rvm: 2.3.1 |
|
| 28 | 28 |
env: DATABASE_ADAPTER=mysql2 DOCKER_IMAGE=cantino/huginn-single-process DOCKERFILE=docker/single-process/Dockerfile |
| 29 |
- - rvm: 2.3.0 |
|
| 29 |
+ - rvm: 2.3.1 |
|
| 30 | 30 |
env: DATABASE_ADAPTER=mysql2 DOCKER_IMAGE=cantino/huginn DOCKERFILE=docker/multi-process/Dockerfile |
| 31 |
- - rvm: 2.3.0 |
|
| 31 |
+ - rvm: 2.3.1 |
|
| 32 | 32 |
env: RSPEC_TASK=spec:features DATABASE_ADAPTER=mysql2 |
| 33 |
- - rvm: 2.3.0 |
|
| 33 |
+ - rvm: 2.3.1 |
|
| 34 | 34 |
env: RSPEC_TASK=spec:features DATABASE_ADAPTER=postgresql DATABASE_USERNAME=postgres |
| 35 | 35 |
rvm: |
| 36 |
-- 2.1 |
|
| 37 | 36 |
- 2.2 |
| 38 |
-- 2.3.0 |
|
| 37 |
+- 2.3.1 |
|
| 39 | 38 |
cache: bundler |
| 40 | 39 |
bundler_args: --without development production |
| 41 | 40 |
before_install: |
@@ -38,7 +38,8 @@ gem 'slack-notifier', '~> 1.0.0' # SlackAgent |
||
| 38 | 38 |
gem 'hypdf', '~> 1.0.10' # PDFInfoAgent |
| 39 | 39 |
|
| 40 | 40 |
# Weibo Agents |
| 41 |
-gem 'weibo_2', github: 'cantino/weibo_2', branch: 'master' |
|
| 41 |
+# FIXME needs to loosen omniauth dependency |
|
| 42 |
+gem 'weibo_2', github: 'dsander/weibo_2', branch: 'master' |
|
| 42 | 43 |
|
| 43 | 44 |
# GoogleCalendarPublishAgent |
| 44 | 45 |
gem "google-api-client", require: 'google/api_client' |
@@ -46,11 +47,11 @@ gem "google-api-client", require: 'google/api_client' |
||
| 46 | 47 |
# Twitter Agents |
| 47 | 48 |
gem 'twitter', '~> 5.14.0' # Must to be loaded before cantino-twitter-stream. |
| 48 | 49 |
gem 'twitter-stream', github: 'cantino/twitter-stream', branch: 'huginn' |
| 49 |
-gem 'omniauth-twitter' |
|
| 50 |
+gem 'omniauth-twitter', '~> 1.2.1' |
|
| 50 | 51 |
|
| 51 | 52 |
# Tumblr Agents |
| 52 | 53 |
gem 'tumblr_client', github: 'tumblr/tumblr_client', branch: 'master' # '>= 0.8.5' |
| 53 |
-gem 'omniauth-tumblr' |
|
| 54 |
+gem 'omniauth-tumblr', '~> 1.2' |
|
| 54 | 55 |
|
| 55 | 56 |
# Dropbox Agents |
| 56 | 57 |
gem 'dropbox-api' |
@@ -71,7 +72,7 @@ gem 'aws-sdk-core', '~> 2.2.15' |
||
| 71 | 72 |
|
| 72 | 73 |
# Optional Services. |
| 73 | 74 |
gem 'omniauth-37signals' # BasecampAgent |
| 74 |
-gem 'omniauth-wunderlist', github: 'wunderlist/omniauth-wunderlist', ref: 'd0910d0396107b9302aa1bc50e74bb140990ccb8' |
|
| 75 |
+gem 'omniauth-wunderlist' |
|
| 75 | 76 |
|
| 76 | 77 |
# Bundler <1.5 does not recognize :x64_mingw as a valid platform name. |
| 77 | 78 |
# Unfortunately, it can't self-update because it errors when encountering :x64_mingw. |
@@ -83,35 +84,33 @@ end |
||
| 83 | 84 |
gem 'ace-rails-ap', '~> 2.0.1' |
| 84 | 85 |
gem 'bootstrap-kaminari-views', '~> 0.0.3' |
| 85 | 86 |
gem 'bundler', '>= 1.5.0' |
| 86 |
-gem 'coffee-rails', '~> 4.1.1' |
|
| 87 |
+gem 'coffee-rails', '~> 4.2' |
|
| 87 | 88 |
gem 'daemons', '~> 1.1.9' |
| 88 | 89 |
gem 'delayed_job', '~> 4.1.0' |
| 89 | 90 |
gem 'delayed_job_active_record', github: 'collectiveidea/delayed_job_active_record', branch: 'master' |
| 90 |
-gem 'devise', '~> 3.5.4' |
|
| 91 |
+gem 'devise','~> 4.2.0' |
|
| 91 | 92 |
gem 'em-http-request', '~> 1.1.2' |
| 92 | 93 |
gem 'faraday', '~> 0.9.0' |
| 93 | 94 |
gem 'faraday_middleware', github: 'lostisland/faraday_middleware', branch: 'master' # '>= 0.10.1' |
| 94 | 95 |
gem 'feed-normalizer' |
| 95 | 96 |
gem 'font-awesome-sass', '~> 4.3.2' |
| 96 | 97 |
gem 'foreman', '~> 0.63.0' |
| 97 |
-# geokit-rails doesn't work with geokit 1.8.X but it specifies ~> 1.5 |
|
| 98 |
-# in its own Gemfile. |
|
| 99 | 98 |
gem 'geokit', '~> 1.8.4' |
| 100 |
-gem 'geokit-rails', '~> 2.0.1' |
|
| 99 |
+gem 'geokit-rails', '~> 2.2.0' |
|
| 101 | 100 |
gem 'httparty', '~> 0.13' |
| 102 | 101 |
gem 'httmultiparty', '~> 0.3.16' |
| 103 |
-gem 'jquery-rails', '~> 3.1.3' |
|
| 102 |
+gem 'jquery-rails', '~> 4.2.1' |
|
| 104 | 103 |
gem 'huginn_agent', '~> 0.4.0' |
| 105 | 104 |
gem 'json', '~> 1.8.1' |
| 106 | 105 |
gem 'jsonpathv2', '~> 0.0.8' |
| 107 |
-gem 'kaminari', '~> 0.16.1' |
|
| 106 |
+gem 'kaminari', github: "amatsuda/kaminari", branch: '0-17-stable' |
|
| 108 | 107 |
gem 'kramdown', '~> 1.3.3' |
| 109 | 108 |
gem 'liquid', '~> 3.0.3' |
| 110 | 109 |
gem 'mini_magick' |
| 111 | 110 |
gem 'multi_xml' |
| 112 | 111 |
gem 'nokogiri', '1.6.8' |
| 113 |
-gem 'omniauth' |
|
| 114 |
-gem 'rails', '4.2.7.1' |
|
| 112 |
+gem 'omniauth', '~> 1.3.1' |
|
| 113 |
+gem 'rails', '~> 5.0.0.1' |
|
| 115 | 114 |
gem 'rufus-scheduler', '~> 3.0.8', require: false |
| 116 | 115 |
gem 'sass-rails', '~> 5.0.6' |
| 117 | 116 |
gem 'select2-rails', '~> 3.5.4' |
@@ -124,12 +123,12 @@ gem 'uglifier', '~> 2.7.2' |
||
| 124 | 123 |
group :development do |
| 125 | 124 |
gem 'better_errors', '~> 1.1' |
| 126 | 125 |
gem 'binding_of_caller' |
| 127 |
- gem 'quiet_assets' |
|
| 128 | 126 |
gem 'guard', '~> 2.13.0' |
| 129 | 127 |
gem 'guard-livereload', '~> 2.5.1' |
| 130 | 128 |
gem 'guard-rspec', '~> 4.6.4' |
| 131 | 129 |
gem 'rack-livereload', '~> 0.3.16' |
| 132 |
- gem 'letter_opener_web' |
|
| 130 |
+ gem 'letter_opener_web', '~> 1.3.0' |
|
| 131 |
+ gem 'web-console' |
|
| 133 | 132 |
|
| 134 | 133 |
gem 'capistrano', '~> 3.4.0' |
| 135 | 134 |
gem 'capistrano-rails', '~> 1.1' |
@@ -137,7 +136,8 @@ group :development do |
||
| 137 | 136 |
|
| 138 | 137 |
if_true(ENV['SPRING']) do |
| 139 | 138 |
gem 'spring-commands-rspec', '~> 1.0.4' |
| 140 |
- gem 'spring', '~> 1.6.3' |
|
| 139 |
+ gem 'spring', '~> 1.7.2' |
|
| 140 |
+ gem 'spring-watcher-listen', '~> 2.0.0' |
|
| 141 | 141 |
end |
| 142 | 142 |
|
| 143 | 143 |
group :test do |
@@ -150,8 +150,9 @@ group :development do |
||
| 150 | 150 |
gem 'rr' |
| 151 | 151 |
gem 'rspec', '~> 3.5' |
| 152 | 152 |
gem 'rspec-collection_matchers', '~> 1.1.0' |
| 153 |
- gem 'rspec-rails', '~> 3.5.1' |
|
| 154 |
- gem 'rspec-html-matchers', '~> 0.7' |
|
| 153 |
+ gem 'rspec-rails', '~> 3.5.2' |
|
| 154 |
+ gem 'rspec-html-matchers', '~> 0.8' |
|
| 155 |
+ gem 'rails-controller-testing' |
|
| 155 | 156 |
gem 'shoulda-matchers' |
| 156 | 157 |
gem 'vcr' |
| 157 | 158 |
gem 'webmock', '~> 1.17.4', require: false |
@@ -160,8 +161,7 @@ group :development do |
||
| 160 | 161 |
end |
| 161 | 162 |
|
| 162 | 163 |
group :production do |
| 163 |
- gem 'rack', '> 1.5.0' |
|
| 164 |
- gem 'unicorn', '~> 4.9.0' |
|
| 164 |
+ gem 'unicorn', '~> 5.1.0' |
|
| 165 | 165 |
end |
| 166 | 166 |
|
| 167 | 167 |
# Platform requirements. |
@@ -183,10 +183,6 @@ ENV['DATABASE_ADAPTER'] ||= |
||
| 183 | 183 |
'mysql2' |
| 184 | 184 |
end |
| 185 | 185 |
|
| 186 |
-if_true(on_heroku) do |
|
| 187 |
- gem 'rails_12factor', group: :production |
|
| 188 |
-end |
|
| 189 |
- |
|
| 190 | 186 |
if_true(ENV['DATABASE_ADAPTER'].strip == 'postgresql') do |
| 191 | 187 |
gem 'pg', '~> 0.18.3' |
| 192 | 188 |
end |
@@ -1,4 +1,13 @@ |
||
| 1 | 1 |
GIT |
| 2 |
+ remote: git://github.com/amatsuda/kaminari.git |
|
| 3 |
+ revision: abbf93d557208ee1d0b612c612cd079f86ed54f4 |
|
| 4 |
+ branch: 0-17-stable |
|
| 5 |
+ specs: |
|
| 6 |
+ kaminari (0.17.0) |
|
| 7 |
+ actionpack (>= 3.0.0) |
|
| 8 |
+ activesupport (>= 3.0.0) |
|
| 9 |
+ |
|
| 10 |
+GIT |
|
| 2 | 11 |
remote: git://github.com/cantino/twitter-stream.git |
| 3 | 12 |
revision: f7e7edb0bae013bffabf3598e7147773d9fd370f |
| 4 | 13 |
branch: huginn |
@@ -9,24 +18,24 @@ GIT |
||
| 9 | 18 |
simple_oauth (~> 0.3.0) |
| 10 | 19 |
|
| 11 | 20 |
GIT |
| 12 |
- remote: git://github.com/cantino/weibo_2.git |
|
| 13 |
- revision: 00e57d29d8252126014b038cd738b02e05e4cfc5 |
|
| 21 |
+ remote: git://github.com/collectiveidea/delayed_job_active_record.git |
|
| 22 |
+ revision: 36f434c4fd660e8f11ce932be117e9c71dde7212 |
|
| 14 | 23 |
branch: master |
| 15 | 24 |
specs: |
| 16 |
- weibo_2 (0.1.7) |
|
| 17 |
- hashie (~> 2.0.4) |
|
| 18 |
- multi_json (~> 1) |
|
| 19 |
- oauth2 (~> 0.9.1) |
|
| 20 |
- rest-client (~> 1.8) |
|
| 25 |
+ delayed_job_active_record (4.1.1) |
|
| 26 |
+ activerecord (>= 3.0, < 5.1) |
|
| 27 |
+ delayed_job (>= 3.0, < 5) |
|
| 21 | 28 |
|
| 22 | 29 |
GIT |
| 23 |
- remote: git://github.com/collectiveidea/delayed_job_active_record.git |
|
| 24 |
- revision: 61e688e03b2ef4004b08de6d1e0a123fda8fffad |
|
| 30 |
+ remote: git://github.com/dsander/weibo_2.git |
|
| 31 |
+ revision: e5b77f21a7e9a666b582c48e16b1e96fca198cf8 |
|
| 25 | 32 |
branch: master |
| 26 | 33 |
specs: |
| 27 |
- delayed_job_active_record (4.1.0) |
|
| 28 |
- activerecord (>= 3.0, < 5.1) |
|
| 29 |
- delayed_job (>= 3.0, < 5) |
|
| 34 |
+ weibo_2 (0.1.7) |
|
| 35 |
+ hashie (~> 3) |
|
| 36 |
+ multi_json (~> 1) |
|
| 37 |
+ oauth2 (~> 1) |
|
| 38 |
+ rest-client (~> 1.8) |
|
| 30 | 39 |
|
| 31 | 40 |
GIT |
| 32 | 41 |
remote: git://github.com/lostisland/faraday_middleware.git |
@@ -49,15 +58,6 @@ GIT |
||
| 49 | 58 |
oauth |
| 50 | 59 |
simple_oauth |
| 51 | 60 |
|
| 52 |
-GIT |
|
| 53 |
- remote: git://github.com/wunderlist/omniauth-wunderlist.git |
|
| 54 |
- revision: d0910d0396107b9302aa1bc50e74bb140990ccb8 |
|
| 55 |
- ref: d0910d0396107b9302aa1bc50e74bb140990ccb8 |
|
| 56 |
- specs: |
|
| 57 |
- omniauth-wunderlist (0.0.1) |
|
| 58 |
- omniauth (~> 1.0) |
|
| 59 |
- omniauth-oauth2 (~> 1.1) |
|
| 60 |
- |
|
| 61 | 61 |
PATH |
| 62 | 62 |
remote: vendor/gems/dotenv-2.0.1 |
| 63 | 63 |
specs: |
@@ -69,50 +69,52 @@ GEM |
||
| 69 | 69 |
remote: https://rubygems.org/ |
| 70 | 70 |
specs: |
| 71 | 71 |
ace-rails-ap (2.0.1) |
| 72 |
- actionmailer (4.2.7.1) |
|
| 73 |
- actionpack (= 4.2.7.1) |
|
| 74 |
- actionview (= 4.2.7.1) |
|
| 75 |
- activejob (= 4.2.7.1) |
|
| 72 |
+ actioncable (5.0.0.1) |
|
| 73 |
+ actionpack (= 5.0.0.1) |
|
| 74 |
+ nio4r (~> 1.2) |
|
| 75 |
+ websocket-driver (~> 0.6.1) |
|
| 76 |
+ actionmailer (5.0.0.1) |
|
| 77 |
+ actionpack (= 5.0.0.1) |
|
| 78 |
+ actionview (= 5.0.0.1) |
|
| 79 |
+ activejob (= 5.0.0.1) |
|
| 76 | 80 |
mail (~> 2.5, >= 2.5.4) |
| 77 |
- rails-dom-testing (~> 1.0, >= 1.0.5) |
|
| 78 |
- actionpack (4.2.7.1) |
|
| 79 |
- actionview (= 4.2.7.1) |
|
| 80 |
- activesupport (= 4.2.7.1) |
|
| 81 |
- rack (~> 1.6) |
|
| 82 |
- rack-test (~> 0.6.2) |
|
| 83 |
- rails-dom-testing (~> 1.0, >= 1.0.5) |
|
| 81 |
+ rails-dom-testing (~> 2.0) |
|
| 82 |
+ actionpack (5.0.0.1) |
|
| 83 |
+ actionview (= 5.0.0.1) |
|
| 84 |
+ activesupport (= 5.0.0.1) |
|
| 85 |
+ rack (~> 2.0) |
|
| 86 |
+ rack-test (~> 0.6.3) |
|
| 87 |
+ rails-dom-testing (~> 2.0) |
|
| 84 | 88 |
rails-html-sanitizer (~> 1.0, >= 1.0.2) |
| 85 |
- actionview (4.2.7.1) |
|
| 86 |
- activesupport (= 4.2.7.1) |
|
| 89 |
+ actionview (5.0.0.1) |
|
| 90 |
+ activesupport (= 5.0.0.1) |
|
| 87 | 91 |
builder (~> 3.1) |
| 88 | 92 |
erubis (~> 2.7.0) |
| 89 |
- rails-dom-testing (~> 1.0, >= 1.0.5) |
|
| 93 |
+ rails-dom-testing (~> 2.0) |
|
| 90 | 94 |
rails-html-sanitizer (~> 1.0, >= 1.0.2) |
| 91 |
- activejob (4.2.7.1) |
|
| 92 |
- activesupport (= 4.2.7.1) |
|
| 93 |
- globalid (>= 0.3.0) |
|
| 94 |
- activemodel (4.2.7.1) |
|
| 95 |
- activesupport (= 4.2.7.1) |
|
| 96 |
- builder (~> 3.1) |
|
| 97 |
- activerecord (4.2.7.1) |
|
| 98 |
- activemodel (= 4.2.7.1) |
|
| 99 |
- activesupport (= 4.2.7.1) |
|
| 100 |
- arel (~> 6.0) |
|
| 101 |
- activesupport (4.2.7.1) |
|
| 95 |
+ activejob (5.0.0.1) |
|
| 96 |
+ activesupport (= 5.0.0.1) |
|
| 97 |
+ globalid (>= 0.3.6) |
|
| 98 |
+ activemodel (5.0.0.1) |
|
| 99 |
+ activesupport (= 5.0.0.1) |
|
| 100 |
+ activerecord (5.0.0.1) |
|
| 101 |
+ activemodel (= 5.0.0.1) |
|
| 102 |
+ activesupport (= 5.0.0.1) |
|
| 103 |
+ arel (~> 7.0) |
|
| 104 |
+ activesupport (5.0.0.1) |
|
| 105 |
+ concurrent-ruby (~> 1.0, >= 1.0.2) |
|
| 102 | 106 |
i18n (~> 0.7) |
| 103 |
- json (~> 1.7, >= 1.7.7) |
|
| 104 | 107 |
minitest (~> 5.1) |
| 105 |
- thread_safe (~> 0.3, >= 0.3.4) |
|
| 106 | 108 |
tzinfo (~> 1.1) |
| 107 | 109 |
addressable (2.3.8) |
| 108 |
- arel (6.0.3) |
|
| 110 |
+ arel (7.1.1) |
|
| 109 | 111 |
autoparse (0.3.3) |
| 110 | 112 |
addressable (>= 2.3.1) |
| 111 | 113 |
extlib (>= 0.9.15) |
| 112 | 114 |
multi_json (>= 1.0.0) |
| 113 | 115 |
aws-sdk-core (2.2.15) |
| 114 | 116 |
jmespath (~> 1.0) |
| 115 |
- bcrypt (3.1.10) |
|
| 117 |
+ bcrypt (3.1.11) |
|
| 116 | 118 |
better_errors (1.1.0) |
| 117 | 119 |
coderay (>= 1.0.0) |
| 118 | 120 |
erubis (>= 2.6.6) |
@@ -147,9 +149,9 @@ GEM |
||
| 147 | 149 |
chronic (0.10.2) |
| 148 | 150 |
cliver (0.3.2) |
| 149 | 151 |
coderay (1.1.0) |
| 150 |
- coffee-rails (4.1.1) |
|
| 152 |
+ coffee-rails (4.2.1) |
|
| 151 | 153 |
coffee-script (>= 2.2.0) |
| 152 |
- railties (>= 4.0.0, < 5.1.x) |
|
| 154 |
+ railties (>= 4.0.0, < 5.2.x) |
|
| 153 | 155 |
coffee-script (2.4.1) |
| 154 | 156 |
coffee-script-source |
| 155 | 157 |
execjs |
@@ -168,16 +170,15 @@ GEM |
||
| 168 | 170 |
daemons (1.1.9) |
| 169 | 171 |
database_cleaner (1.5.3) |
| 170 | 172 |
debug_inspector (0.0.2) |
| 171 |
- delayed_job (4.1.1) |
|
| 172 |
- activesupport (>= 3.0, < 5.0) |
|
| 173 |
+ delayed_job (4.1.2) |
|
| 174 |
+ activesupport (>= 3.0, < 5.1) |
|
| 173 | 175 |
delorean (2.1.0) |
| 174 | 176 |
chronic |
| 175 |
- devise (3.5.4) |
|
| 177 |
+ devise (4.2.0) |
|
| 176 | 178 |
bcrypt (~> 3.0) |
| 177 | 179 |
orm_adapter (~> 0.1) |
| 178 |
- railties (>= 3.2.6, < 5) |
|
| 180 |
+ railties (>= 4.1.0, < 5.1) |
|
| 179 | 181 |
responders |
| 180 |
- thread_safe (~> 0.1) |
|
| 181 | 182 |
warden (~> 1.2.3) |
| 182 | 183 |
diff-lcs (1.2.5) |
| 183 | 184 |
docile (1.1.5) |
@@ -229,7 +230,7 @@ GEM |
||
| 229 | 230 |
formatador (0.2.5) |
| 230 | 231 |
geokit (1.8.5) |
| 231 | 232 |
multi_json (>= 1.3.2) |
| 232 |
- geokit-rails (2.0.1) |
|
| 233 |
+ geokit-rails (2.2.0) |
|
| 233 | 234 |
geokit (~> 1.5) |
| 234 | 235 |
rails (>= 3.0) |
| 235 | 236 |
globalid (0.3.7) |
@@ -260,11 +261,11 @@ GEM |
||
| 260 | 261 |
guard (~> 2.8) |
| 261 | 262 |
guard-compat (~> 1.0) |
| 262 | 263 |
multi_json (~> 1.8) |
| 263 |
- guard-rspec (4.6.4) |
|
| 264 |
+ guard-rspec (4.6.5) |
|
| 264 | 265 |
guard (~> 2.1) |
| 265 | 266 |
guard-compat (~> 1.1) |
| 266 | 267 |
rspec (>= 2.99.0, < 4.0) |
| 267 |
- hashie (2.0.5) |
|
| 268 |
+ hashie (3.4.4) |
|
| 268 | 269 |
haversine (0.3.0) |
| 269 | 270 |
hipchat (1.2.0) |
| 270 | 271 |
httparty |
@@ -288,17 +289,15 @@ GEM |
||
| 288 | 289 |
httparty (~> 0.13) |
| 289 | 290 |
i18n (0.7.0) |
| 290 | 291 |
jmespath (1.1.3) |
| 291 |
- jquery-rails (3.1.3) |
|
| 292 |
- railties (>= 3.0, < 5.0) |
|
| 292 |
+ jquery-rails (4.2.1) |
|
| 293 |
+ rails-dom-testing (>= 1, < 3) |
|
| 294 |
+ railties (>= 4.2.0) |
|
| 293 | 295 |
thor (>= 0.14, < 2.0) |
| 294 | 296 |
json (1.8.3) |
| 295 | 297 |
jsonpathv2 (0.0.8) |
| 296 | 298 |
multi_json |
| 297 | 299 |
jwt (1.4.1) |
| 298 |
- kaminari (0.16.1) |
|
| 299 |
- actionpack (>= 3.0.0) |
|
| 300 |
- activesupport (>= 3.0.0) |
|
| 301 |
- kgio (2.9.3) |
|
| 300 |
+ kgio (2.10.0) |
|
| 302 | 301 |
kramdown (1.3.3) |
| 303 | 302 |
launchy (2.4.2) |
| 304 | 303 |
addressable (~> 2.3) |
@@ -323,13 +322,13 @@ GEM |
||
| 323 | 322 |
memoizable (0.4.2) |
| 324 | 323 |
thread_safe (~> 0.3, >= 0.3.1) |
| 325 | 324 |
method_source (0.8.2) |
| 326 |
- mime-types (2.99.2) |
|
| 325 |
+ mime-types (2.99.3) |
|
| 327 | 326 |
mimemagic (0.3.1) |
| 328 | 327 |
mini_magick (4.2.3) |
| 329 | 328 |
mini_portile2 (2.1.0) |
| 330 | 329 |
minitest (5.9.0) |
| 331 | 330 |
mqtt (0.3.1) |
| 332 |
- multi_json (1.11.2) |
|
| 331 |
+ multi_json (1.12.1) |
|
| 333 | 332 |
multi_xml (0.5.5) |
| 334 | 333 |
multipart-post (2.0.0) |
| 335 | 334 |
mysql2 (0.3.20) |
@@ -340,6 +339,7 @@ GEM |
||
| 340 | 339 |
net-ssh (>= 2.6.5) |
| 341 | 340 |
net-ssh (3.0.2) |
| 342 | 341 |
netrc (0.10.3) |
| 342 |
+ nio4r (1.2.1) |
|
| 343 | 343 |
nokogiri (1.6.8) |
| 344 | 344 |
mini_portile2 (~> 2.1.0) |
| 345 | 345 |
pkg-config (~> 1.1.7) |
@@ -347,15 +347,15 @@ GEM |
||
| 347 | 347 |
nenv (~> 0.1) |
| 348 | 348 |
shellany (~> 0.0) |
| 349 | 349 |
oauth (0.4.7) |
| 350 |
- oauth2 (0.9.4) |
|
| 350 |
+ oauth2 (1.2.0) |
|
| 351 | 351 |
faraday (>= 0.8, < 0.10) |
| 352 | 352 |
jwt (~> 1.0) |
| 353 | 353 |
multi_json (~> 1.3) |
| 354 | 354 |
multi_xml (~> 0.5) |
| 355 |
- rack (~> 1.2) |
|
| 356 |
- omniauth (1.2.2) |
|
| 355 |
+ rack (>= 1.2, < 3) |
|
| 356 |
+ omniauth (1.3.1) |
|
| 357 | 357 |
hashie (>= 1.2, < 4) |
| 358 |
- rack (~> 1.0) |
|
| 358 |
+ rack (>= 1.0, < 3) |
|
| 359 | 359 |
omniauth-37signals (1.0.5) |
| 360 | 360 |
omniauth (~> 1.0) |
| 361 | 361 |
omniauth-oauth2 (~> 1.0) |
@@ -365,19 +365,21 @@ GEM |
||
| 365 | 365 |
evernote-thrift |
| 366 | 366 |
multi_json (~> 1.0) |
| 367 | 367 |
omniauth-oauth (~> 1.0) |
| 368 |
- omniauth-oauth (1.0.1) |
|
| 368 |
+ omniauth-oauth (1.1.0) |
|
| 369 | 369 |
oauth |
| 370 | 370 |
omniauth (~> 1.0) |
| 371 |
- omniauth-oauth2 (1.1.2) |
|
| 372 |
- faraday (>= 0.8, < 0.10) |
|
| 373 |
- multi_json (~> 1.3) |
|
| 374 |
- oauth2 (~> 0.9.3) |
|
| 371 |
+ omniauth-oauth2 (1.3.1) |
|
| 372 |
+ oauth2 (~> 1.0) |
|
| 375 | 373 |
omniauth (~> 1.2) |
| 376 |
- omniauth-tumblr (1.1) |
|
| 377 |
- omniauth-oauth (~> 1.0) |
|
| 378 |
- omniauth-twitter (1.0.1) |
|
| 379 |
- multi_json (~> 1.3) |
|
| 374 |
+ omniauth-tumblr (1.2) |
|
| 375 |
+ multi_json |
|
| 380 | 376 |
omniauth-oauth (~> 1.0) |
| 377 |
+ omniauth-twitter (1.2.1) |
|
| 378 |
+ json (~> 1.3) |
|
| 379 |
+ omniauth-oauth (~> 1.1) |
|
| 380 |
+ omniauth-wunderlist (0.0.2) |
|
| 381 |
+ omniauth (~> 1.0) |
|
| 382 |
+ omniauth-oauth2 (~> 1.1) |
|
| 381 | 383 |
orm_adapter (0.5.0) |
| 382 | 384 |
pg (0.18.3) |
| 383 | 385 |
pkg-config (1.1.7) |
@@ -396,49 +398,45 @@ GEM |
||
| 396 | 398 |
pry (~> 0.10) |
| 397 | 399 |
pry-rails (0.3.4) |
| 398 | 400 |
pry (>= 0.9.10) |
| 399 |
- quiet_assets (1.1.0) |
|
| 400 |
- railties (>= 3.1, < 5.0) |
|
| 401 |
- rack (1.6.4) |
|
| 401 |
+ rack (2.0.1) |
|
| 402 | 402 |
rack-livereload (0.3.16) |
| 403 | 403 |
rack |
| 404 | 404 |
rack-test (0.6.3) |
| 405 | 405 |
rack (>= 1.0) |
| 406 |
- rails (4.2.7.1) |
|
| 407 |
- actionmailer (= 4.2.7.1) |
|
| 408 |
- actionpack (= 4.2.7.1) |
|
| 409 |
- actionview (= 4.2.7.1) |
|
| 410 |
- activejob (= 4.2.7.1) |
|
| 411 |
- activemodel (= 4.2.7.1) |
|
| 412 |
- activerecord (= 4.2.7.1) |
|
| 413 |
- activesupport (= 4.2.7.1) |
|
| 406 |
+ rails (5.0.0.1) |
|
| 407 |
+ actioncable (= 5.0.0.1) |
|
| 408 |
+ actionmailer (= 5.0.0.1) |
|
| 409 |
+ actionpack (= 5.0.0.1) |
|
| 410 |
+ actionview (= 5.0.0.1) |
|
| 411 |
+ activejob (= 5.0.0.1) |
|
| 412 |
+ activemodel (= 5.0.0.1) |
|
| 413 |
+ activerecord (= 5.0.0.1) |
|
| 414 |
+ activesupport (= 5.0.0.1) |
|
| 414 | 415 |
bundler (>= 1.3.0, < 2.0) |
| 415 |
- railties (= 4.2.7.1) |
|
| 416 |
- sprockets-rails |
|
| 417 |
- rails-deprecated_sanitizer (1.0.3) |
|
| 418 |
- activesupport (>= 4.2.0.alpha) |
|
| 419 |
- rails-dom-testing (1.0.7) |
|
| 420 |
- activesupport (>= 4.2.0.beta, < 5.0) |
|
| 416 |
+ railties (= 5.0.0.1) |
|
| 417 |
+ sprockets-rails (>= 2.0.0) |
|
| 418 |
+ rails-controller-testing (1.0.1) |
|
| 419 |
+ actionpack (~> 5.x) |
|
| 420 |
+ actionview (~> 5.x) |
|
| 421 |
+ activesupport (~> 5.x) |
|
| 422 |
+ rails-dom-testing (2.0.1) |
|
| 423 |
+ activesupport (>= 4.2.0, < 6.0) |
|
| 421 | 424 |
nokogiri (~> 1.6.0) |
| 422 |
- rails-deprecated_sanitizer (>= 1.0.1) |
|
| 423 | 425 |
rails-html-sanitizer (1.0.3) |
| 424 | 426 |
loofah (~> 2.0) |
| 425 |
- rails_12factor (0.0.3) |
|
| 426 |
- rails_serve_static_assets |
|
| 427 |
- rails_stdout_logging |
|
| 428 |
- rails_serve_static_assets (0.0.4) |
|
| 429 |
- rails_stdout_logging (0.0.3) |
|
| 430 |
- railties (4.2.7.1) |
|
| 431 |
- actionpack (= 4.2.7.1) |
|
| 432 |
- activesupport (= 4.2.7.1) |
|
| 427 |
+ railties (5.0.0.1) |
|
| 428 |
+ actionpack (= 5.0.0.1) |
|
| 429 |
+ activesupport (= 5.0.0.1) |
|
| 430 |
+ method_source |
|
| 433 | 431 |
rake (>= 0.8.7) |
| 434 | 432 |
thor (>= 0.18.1, < 2.0) |
| 435 |
- raindrops (0.13.0) |
|
| 433 |
+ raindrops (0.17.0) |
|
| 436 | 434 |
rake (11.2.2) |
| 437 | 435 |
rb-fsevent (0.9.7) |
| 438 | 436 |
rb-inotify (0.9.5) |
| 439 | 437 |
ffi (>= 0.5.0) |
| 440 | 438 |
ref (2.0.0) |
| 441 |
- responders (2.1.1) |
|
| 439 |
+ responders (2.3.0) |
|
| 442 | 440 |
railties (>= 4.2.0, < 5.1) |
| 443 | 441 |
rest-client (1.8.0) |
| 444 | 442 |
http-cookie (>= 1.0.2, < 2.0) |
@@ -457,13 +455,13 @@ GEM |
||
| 457 | 455 |
rspec-expectations (3.5.0) |
| 458 | 456 |
diff-lcs (>= 1.2.0, < 2.0) |
| 459 | 457 |
rspec-support (~> 3.5.0) |
| 460 |
- rspec-html-matchers (0.7.0) |
|
| 458 |
+ rspec-html-matchers (0.8.1) |
|
| 461 | 459 |
nokogiri (~> 1) |
| 462 |
- rspec (~> 3) |
|
| 460 |
+ rspec (>= 3.0.0.a, < 4) |
|
| 463 | 461 |
rspec-mocks (3.5.0) |
| 464 | 462 |
diff-lcs (>= 1.2.0, < 2.0) |
| 465 | 463 |
rspec-support (~> 3.5.0) |
| 466 |
- rspec-rails (3.5.1) |
|
| 464 |
+ rspec-rails (3.5.2) |
|
| 467 | 465 |
actionpack (>= 3.0) |
| 468 | 466 |
activesupport (>= 3.0) |
| 469 | 467 |
railties (>= 3.0) |
@@ -509,13 +507,16 @@ GEM |
||
| 509 | 507 |
slop (3.6.0) |
| 510 | 508 |
spectrum-rails (1.3.4) |
| 511 | 509 |
railties (>= 3.1) |
| 512 |
- spring (1.6.3) |
|
| 510 |
+ spring (1.7.2) |
|
| 513 | 511 |
spring-commands-rspec (1.0.4) |
| 514 | 512 |
spring (>= 0.9.1) |
| 513 |
+ spring-watcher-listen (2.0.0) |
|
| 514 |
+ listen (>= 2.7, < 4.0) |
|
| 515 |
+ spring (~> 1.2) |
|
| 515 | 516 |
sprockets (3.7.0) |
| 516 | 517 |
concurrent-ruby (~> 1.0) |
| 517 | 518 |
rack (> 1, < 3) |
| 518 |
- sprockets-rails (3.1.1) |
|
| 519 |
+ sprockets-rails (3.2.0) |
|
| 519 | 520 |
actionpack (>= 4.0) |
| 520 | 521 |
activesupport (>= 4.0) |
| 521 | 522 |
sprockets (>= 3.0.0) |
@@ -561,20 +562,24 @@ GEM |
||
| 561 | 562 |
unf (0.1.4) |
| 562 | 563 |
unf_ext |
| 563 | 564 |
unf_ext (0.0.7.1) |
| 564 |
- unicorn (4.9.0) |
|
| 565 |
+ unicorn (5.1.0) |
|
| 565 | 566 |
kgio (~> 2.6) |
| 566 |
- rack |
|
| 567 | 567 |
raindrops (~> 0.7) |
| 568 | 568 |
uuid (2.3.7) |
| 569 | 569 |
macaddr (~> 1.0) |
| 570 | 570 |
uuidtools (2.1.5) |
| 571 | 571 |
vcr (2.9.2) |
| 572 |
- warden (1.2.4) |
|
| 572 |
+ warden (1.2.6) |
|
| 573 | 573 |
rack (>= 1.0) |
| 574 |
+ web-console (3.3.1) |
|
| 575 |
+ actionview (>= 5.0) |
|
| 576 |
+ activemodel (>= 5.0) |
|
| 577 |
+ debug_inspector |
|
| 578 |
+ railties (>= 5.0) |
|
| 574 | 579 |
webmock (1.17.4) |
| 575 | 580 |
addressable (>= 2.2.7) |
| 576 | 581 |
crack (>= 0.3.2) |
| 577 |
- websocket-driver (0.6.3) |
|
| 582 |
+ websocket-driver (0.6.4) |
|
| 578 | 583 |
websocket-extensions (>= 0.1.0) |
| 579 | 584 |
websocket-extensions (0.1.2) |
| 580 | 585 |
wunderground (1.2.0) |
@@ -599,14 +604,14 @@ DEPENDENCIES |
||
| 599 | 604 |
capistrano-bundler (~> 1.1.4) |
| 600 | 605 |
capistrano-rails (~> 1.1) |
| 601 | 606 |
capybara-select2 |
| 602 |
- coffee-rails (~> 4.1.1) |
|
| 607 |
+ coffee-rails (~> 4.2) |
|
| 603 | 608 |
coveralls (~> 0.7.4) |
| 604 | 609 |
daemons (~> 1.1.9) |
| 605 | 610 |
database_cleaner (~> 1.5.3) |
| 606 | 611 |
delayed_job (~> 4.1.0) |
| 607 | 612 |
delayed_job_active_record! |
| 608 | 613 |
delorean |
| 609 |
- devise (~> 3.5.4) |
|
| 614 |
+ devise (~> 4.2.0) |
|
| 610 | 615 |
dotenv! |
| 611 | 616 |
dotenv-rails! |
| 612 | 617 |
dropbox-api |
@@ -620,7 +625,7 @@ DEPENDENCIES |
||
| 620 | 625 |
forecast_io (~> 2.0.0) |
| 621 | 626 |
foreman (~> 0.63.0) |
| 622 | 627 |
geokit (~> 1.8.4) |
| 623 |
- geokit-rails (~> 2.0.1) |
|
| 628 |
+ geokit-rails (~> 2.2.0) |
|
| 624 | 629 |
google-api-client |
| 625 | 630 |
guard (~> 2.13.0) |
| 626 | 631 |
guard-livereload (~> 2.5.1) |
@@ -631,12 +636,12 @@ DEPENDENCIES |
||
| 631 | 636 |
httparty (~> 0.13) |
| 632 | 637 |
huginn_agent (~> 0.4.0) |
| 633 | 638 |
hypdf (~> 1.0.10) |
| 634 |
- jquery-rails (~> 3.1.3) |
|
| 639 |
+ jquery-rails (~> 4.2.1) |
|
| 635 | 640 |
json (~> 1.8.1) |
| 636 | 641 |
jsonpathv2 (~> 0.0.8) |
| 637 |
- kaminari (~> 0.16.1) |
|
| 642 |
+ kaminari! |
|
| 638 | 643 |
kramdown (~> 1.3.3) |
| 639 |
- letter_opener_web |
|
| 644 |
+ letter_opener_web (~> 1.3.0) |
|
| 640 | 645 |
liquid (~> 3.0.3) |
| 641 | 646 |
listen (~> 3.0.5) |
| 642 | 647 |
mini_magick |
@@ -645,27 +650,25 @@ DEPENDENCIES |
||
| 645 | 650 |
mysql2 (~> 0.3.20) |
| 646 | 651 |
net-ftp-list (~> 3.2.8) |
| 647 | 652 |
nokogiri (= 1.6.8) |
| 648 |
- omniauth |
|
| 653 |
+ omniauth (~> 1.3.1) |
|
| 649 | 654 |
omniauth-37signals |
| 650 | 655 |
omniauth-dropbox |
| 651 | 656 |
omniauth-evernote |
| 652 |
- omniauth-tumblr |
|
| 653 |
- omniauth-twitter |
|
| 654 |
- omniauth-wunderlist! |
|
| 657 |
+ omniauth-tumblr (~> 1.2) |
|
| 658 |
+ omniauth-twitter (~> 1.2.1) |
|
| 659 |
+ omniauth-wunderlist |
|
| 655 | 660 |
pg (~> 0.18.3) |
| 656 | 661 |
poltergeist |
| 657 | 662 |
pry-byebug |
| 658 | 663 |
pry-rails |
| 659 |
- quiet_assets |
|
| 660 |
- rack (> 1.5.0) |
|
| 661 | 664 |
rack-livereload (~> 0.3.16) |
| 662 |
- rails (= 4.2.7.1) |
|
| 663 |
- rails_12factor |
|
| 665 |
+ rails (~> 5.0.0.1) |
|
| 666 |
+ rails-controller-testing |
|
| 664 | 667 |
rr |
| 665 | 668 |
rspec (~> 3.5) |
| 666 | 669 |
rspec-collection_matchers (~> 1.1.0) |
| 667 |
- rspec-html-matchers (~> 0.7) |
|
| 668 |
- rspec-rails (~> 3.5.1) |
|
| 670 |
+ rspec-html-matchers (~> 0.8) |
|
| 671 |
+ rspec-rails (~> 3.5.2) |
|
| 669 | 672 |
rturk (~> 2.12.1) |
| 670 | 673 |
ruby-growl (~> 4.1.0) |
| 671 | 674 |
rufus-scheduler (~> 3.0.8) |
@@ -674,8 +677,9 @@ DEPENDENCIES |
||
| 674 | 677 |
shoulda-matchers |
| 675 | 678 |
slack-notifier (~> 1.0.0) |
| 676 | 679 |
spectrum-rails |
| 677 |
- spring (~> 1.6.3) |
|
| 680 |
+ spring (~> 1.7.2) |
|
| 678 | 681 |
spring-commands-rspec (~> 1.0.4) |
| 682 |
+ spring-watcher-listen (~> 2.0.0) |
|
| 679 | 683 |
string-scrub |
| 680 | 684 |
therubyracer (~> 0.12.2) |
| 681 | 685 |
tumblr_client! |
@@ -686,12 +690,16 @@ DEPENDENCIES |
||
| 686 | 690 |
tzinfo (>= 1.2.0) |
| 687 | 691 |
tzinfo-data |
| 688 | 692 |
uglifier (~> 2.7.2) |
| 689 |
- unicorn (~> 4.9.0) |
|
| 693 |
+ unicorn (~> 5.1.0) |
|
| 690 | 694 |
vcr |
| 695 |
+ web-console |
|
| 691 | 696 |
webmock (~> 1.17.4) |
| 692 | 697 |
weibo_2! |
| 693 | 698 |
wunderground (~> 1.2.0) |
| 694 | 699 |
xmpp4r (~> 0.5.6) |
| 695 | 700 |
|
| 701 |
+RUBY VERSION |
|
| 702 |
+ ruby 2.3.1p112 |
|
| 703 |
+ |
|
| 696 | 704 |
BUNDLED WITH |
| 697 | 705 |
1.12.5 |
@@ -2,6 +2,6 @@ |
||
| 2 | 2 |
# Add your own tasks in files placed in lib/tasks ending in .rake, |
| 3 | 3 |
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. |
| 4 | 4 |
|
| 5 |
-require File.expand_path('../config/application', __FILE__)
|
|
| 5 |
+require_relative 'config/application' |
|
| 6 | 6 |
|
| 7 | 7 |
Huginn::Application.load_tasks |
@@ -76,4 +76,10 @@ module LiquidDroppable |
||
| 76 | 76 |
URIDrop.new(self) |
| 77 | 77 |
end |
| 78 | 78 |
end |
| 79 |
+ |
|
| 80 |
+ class ::ActiveRecord::Associations::CollectionProxy |
|
| 81 |
+ def to_liquid |
|
| 82 |
+ self.to_a.to_liquid |
|
| 83 |
+ end |
|
| 84 |
+ end |
|
| 79 | 85 |
end |
@@ -38,7 +38,7 @@ class Admin::UsersController < ApplicationController |
||
| 38 | 38 |
end |
| 39 | 39 |
|
| 40 | 40 |
def update |
| 41 |
- params[:user].except!(:password, :password_confirmation) if params[:user][:password].blank? |
|
| 41 |
+ params[:user].extract!(:password, :password_confirmation) if params[:user][:password].blank? |
|
| 42 | 42 |
@user.assign_attributes(user_params) |
| 43 | 43 |
|
| 44 | 44 |
respond_to do |format| |
@@ -84,7 +84,7 @@ class Admin::UsersController < ApplicationController |
||
| 84 | 84 |
def switch_to_user |
| 85 | 85 |
if current_user != @user |
| 86 | 86 |
old_user = current_user |
| 87 |
- sign_in(:user, @user, { bypass: true })
|
|
| 87 |
+ bypass_sign_in(@user) |
|
| 88 | 88 |
session[:original_admin_user_id] = old_user.id |
| 89 | 89 |
end |
| 90 | 90 |
redirect_to agents_path |
@@ -92,7 +92,7 @@ class Admin::UsersController < ApplicationController |
||
| 92 | 92 |
|
| 93 | 93 |
def switch_back |
| 94 | 94 |
if session[:original_admin_user_id].present? |
| 95 |
- sign_in(:user, User.find(session[:original_admin_user_id]), { bypass: true })
|
|
| 95 |
+ bypass_sign_in(User.find(session[:original_admin_user_id])) |
|
| 96 | 96 |
session.delete(:original_admin_user_id) |
| 97 | 97 |
else |
| 98 | 98 |
redirect_to(root_path, alert: 'You must be an admin acting as a different user to do that.') and return |
@@ -8,6 +8,8 @@ module Agents |
||
| 8 | 8 |
elsif params[:source_ids] |
| 9 | 9 |
Event.where(agent_id: current_user.agents.where(id: params[:source_ids]).pluck(:id)) |
| 10 | 10 |
.order("id DESC").limit(5)
|
| 11 |
+ else |
|
| 12 |
+ [] |
|
| 11 | 13 |
end |
| 12 | 14 |
|
| 13 | 15 |
render layout: false |
@@ -18,7 +20,7 @@ module Agents |
||
| 18 | 20 |
if agent = current_user.agents.find_by(id: params[:agent_id]) |
| 19 | 21 |
# POST /agents/:id/dry_run |
| 20 | 22 |
if attrs.present? |
| 21 |
- attrs.merge!(memory: agent.memory) |
|
| 23 |
+ attrs = attrs.merge(memory: agent.memory) |
|
| 22 | 24 |
type = agent.type |
| 23 | 25 |
agent = Agent.build_for_type(type, current_user, attrs) |
| 24 | 26 |
end |
@@ -196,9 +196,9 @@ class AgentsController < ApplicationController |
||
| 196 | 196 |
build_agent |
| 197 | 197 |
|
| 198 | 198 |
if @agent.validate_option(params[:attribute]) |
| 199 |
- render text: 'ok' |
|
| 199 |
+ render plain: 'ok' |
|
| 200 | 200 |
else |
| 201 |
- render text: 'error', status: 403 |
|
| 201 |
+ render plain: 'error', status: 403 |
|
| 202 | 202 |
end |
| 203 | 203 |
end |
| 204 | 204 |
|
@@ -12,18 +12,16 @@ class ApplicationController < ActionController::Base |
||
| 12 | 12 |
render template: 'application/undefined_agents' |
| 13 | 13 |
end |
| 14 | 14 |
|
| 15 |
- def redirect_back(fallback_path, *args) |
|
| 16 |
- redirect_to :back, *args |
|
| 17 |
- rescue ActionController::RedirectBackError |
|
| 18 |
- redirect_to fallback_path, *args |
|
| 15 |
+ def redirect_back(fallback_path, **args) |
|
| 16 |
+ super(fallback_location: fallback_path, **args) |
|
| 19 | 17 |
end |
| 20 | 18 |
|
| 21 | 19 |
protected |
| 22 | 20 |
|
| 23 | 21 |
def configure_permitted_parameters |
| 24 |
- devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:username, :email, :password, :password_confirmation, :remember_me, :invitation_code) }
|
|
| 25 |
- devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:login, :username, :email, :password, :remember_me) }
|
|
| 26 |
- devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:username, :email, :password, :password_confirmation, :current_password) }
|
|
| 22 |
+ devise_parameter_sanitizer.permit(:sign_up, keys: [:username, :email, :password, :password_confirmation, :remember_me, :invitation_code]) |
|
| 23 |
+ devise_parameter_sanitizer.permit(:sign_in, keys: [:login, :username, :email, :password, :remember_me]) |
|
| 24 |
+ devise_parameter_sanitizer.permit(:account_update, keys: [:username, :email, :password, :password_confirmation, :current_password]) |
|
| 27 | 25 |
end |
| 28 | 26 |
|
| 29 | 27 |
def authenticate_admin! |
@@ -74,6 +72,7 @@ class ApplicationController < ActionController::Base |
||
| 74 | 72 |
params[:agent].permit(:memory, :name, :type, :schedule, :disabled, :keep_events_for, :propagate_immediately, :drop_pending_events, :service_id, |
| 75 | 73 |
source_ids: [], receiver_ids: [], scenario_ids: [], controller_ids: [], control_target_ids: []).tap do |agent_params| |
| 76 | 74 |
agent_params[:options] = options if options |
| 75 |
+ agent_params[:options].permit! if agent_params[:options].respond_to?(:permit!) |
|
| 77 | 76 |
end |
| 78 | 77 |
end |
| 79 | 78 |
end |
@@ -4,7 +4,7 @@ class ScenarioImportsController < ApplicationController |
||
| 4 | 4 |
end |
| 5 | 5 |
|
| 6 | 6 |
def create |
| 7 |
- @scenario_import = ScenarioImport.new(params[:scenario_import]) |
|
| 7 |
+ @scenario_import = ScenarioImport.new(scenario_import_params) |
|
| 8 | 8 |
@scenario_import.set_user(current_user) |
| 9 | 9 |
|
| 10 | 10 |
if @scenario_import.valid? && @scenario_import.import_confirmed? && @scenario_import.import |
@@ -13,4 +13,13 @@ class ScenarioImportsController < ApplicationController |
||
| 13 | 13 |
render action: "new" |
| 14 | 14 |
end |
| 15 | 15 |
end |
| 16 |
+ |
|
| 17 |
+ private |
|
| 18 |
+ |
|
| 19 |
+ def scenario_import_params |
|
| 20 |
+ merges = params[:scenario_import].delete(:merges) |
|
| 21 |
+ params.require(:scenario_import).permit(:url, :data, :file, :do_import) do |params| |
|
| 22 |
+ params[:merges] = merges |
|
| 23 |
+ end |
|
| 24 |
+ end |
|
| 16 | 25 |
end |
@@ -1,3 +1,5 @@ |
||
| 1 |
+require 'agents_exporter' |
|
| 2 |
+ |
|
| 1 | 3 |
class ScenariosController < ApplicationController |
| 2 | 4 |
include SortableTable |
| 3 | 5 |
skip_before_action :authenticate_user!, only: :export |
@@ -27,17 +27,17 @@ class WebRequestsController < ApplicationController |
||
| 27 | 27 |
content, status, content_type = agent.trigger_web_request(request) |
| 28 | 28 |
|
| 29 | 29 |
if content.is_a?(String) |
| 30 |
- render :text => content, :status => status || 200, :content_type => content_type || 'text/plain' |
|
| 30 |
+ render plain: content, :status => status || 200, :content_type => content_type || 'text/plain' |
|
| 31 | 31 |
elsif content.is_a?(Hash) |
| 32 | 32 |
render :json => content, :status => status || 200 |
| 33 | 33 |
else |
| 34 | 34 |
head(status || 200) |
| 35 | 35 |
end |
| 36 | 36 |
else |
| 37 |
- render :text => "agent not found", :status => 404 |
|
| 37 |
+ render plain: "agent not found", :status => 404 |
|
| 38 | 38 |
end |
| 39 | 39 |
else |
| 40 |
- render :text => "user not found", :status => 404 |
|
| 40 |
+ render plain: "user not found", :status => 404 |
|
| 41 | 41 |
end |
| 42 | 42 |
end |
| 43 | 43 |
|
@@ -50,9 +50,9 @@ class WebRequestsController < ApplicationController |
||
| 50 | 50 |
agent.trigger_web_request(request) |
| 51 | 51 |
end |
| 52 | 52 |
} |
| 53 |
- render :text => "ok" |
|
| 53 |
+ render plain: "ok" |
|
| 54 | 54 |
else |
| 55 |
- render :text => "user not found", :status => :not_found |
|
| 55 |
+ render plain: "user not found", :status => :not_found |
|
| 56 | 56 |
end |
| 57 | 57 |
end |
| 58 | 58 |
end |
@@ -117,4 +117,10 @@ module ApplicationHelper |
||
| 117 | 117 |
def agent_type_to_human(type) |
| 118 | 118 |
type.gsub(/^.*::/, '').underscore.humanize.titleize |
| 119 | 119 |
end |
| 120 |
+ |
|
| 121 |
+ private |
|
| 122 |
+ |
|
| 123 |
+ def user_omniauth_authorize_path(provider) |
|
| 124 |
+ send "user_#{provider}_omniauth_authorize_path"
|
|
| 125 |
+ end |
|
| 120 | 126 |
end |
@@ -6,7 +6,7 @@ class AgentPropagateJob < ActiveJob::Base |
||
| 6 | 6 |
end |
| 7 | 7 |
|
| 8 | 8 |
def self.can_enqueue? |
| 9 |
- case queue_adapter.name # not using class since it would load adapter dependent gems |
|
| 9 |
+ case queue_adapter.class.name # not using class since it would load adapter dependent gems |
|
| 10 | 10 |
when 'ActiveJob::QueueAdapters::DelayedJobAdapter' |
| 11 | 11 |
return Delayed::Job.where(failed_at: nil, queue: 'propagation').count == 0 |
| 12 | 12 |
when 'ActiveJob::QueueAdapters::ResqueAdapter' |
@@ -91,7 +91,8 @@ module Agents |
||
| 91 | 91 |
end |
| 92 | 92 |
|
| 93 | 93 |
def receive(incoming_events) |
| 94 |
- incoming_events.each do |event| |
|
| 94 |
+ require 'google_calendar' |
|
| 95 |
+ incoming_events.each do |event| |
|
| 95 | 96 |
calendar = GoogleCalendar.new(interpolate_options(options, event), Rails.logger) |
| 96 | 97 |
|
| 97 | 98 |
calendar_event = JSON.parse(calendar.publish_as(interpolated(event)['calendar_id'], event.payload["message"]).response.body) |
@@ -1,3 +1,5 @@ |
||
| 1 |
+require 'time_tracker' |
|
| 2 |
+ |
|
| 1 | 3 |
module Agents |
| 2 | 4 |
|
| 3 | 5 |
class HttpStatusAgent < Agent |
@@ -88,6 +88,6 @@ class User < ActiveRecord::Base |
||
| 88 | 88 |
end |
| 89 | 89 |
|
| 90 | 90 |
def undefined_agents |
| 91 |
- agents.where(type: undefined_agent_types).select('id, schedule, type as undefined')
|
|
| 91 |
+ agents.where(type: undefined_agent_types).select('id, schedule, events_count, type as undefined')
|
|
| 92 | 92 |
end |
| 93 | 93 |
end |
@@ -4,6 +4,6 @@ begin |
||
| 4 | 4 |
rescue LoadError => e |
| 5 | 5 |
raise unless e.message.include?('spring')
|
| 6 | 6 |
end |
| 7 |
-APP_PATH = File.expand_path('../../config/application', __FILE__)
|
|
| 7 |
+APP_PATH = File.expand_path('../config/application', __dir__)
|
|
| 8 | 8 |
require_relative '../config/boot' |
| 9 | 9 |
require 'rails/commands' |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 |
# This file is used by Rack-based servers to start the application. |
| 2 | 2 |
|
| 3 |
-require ::File.expand_path('../config/environment', __FILE__)
|
|
| 3 |
+require_relative 'config/environment' |
|
| 4 | 4 |
|
| 5 | 5 |
run Huginn::Application |
@@ -1,4 +1,4 @@ |
||
| 1 |
-require File.expand_path('../boot', __FILE__)
|
|
| 1 |
+require_relative 'boot' |
|
| 2 | 2 |
|
| 3 | 3 |
require 'rails/all' |
| 4 | 4 |
|
@@ -39,9 +39,6 @@ module Huginn |
||
| 39 | 39 |
# like if you have constraints or database-specific column types |
| 40 | 40 |
# config.active_record.schema_format = :sql |
| 41 | 41 |
|
| 42 |
- # Do not swallow errors in after_commit/after_rollback callbacks. |
|
| 43 |
- config.active_record.raise_in_transactional_callbacks = true |
|
| 44 |
- |
|
| 45 | 42 |
config.active_job.queue_adapter = :delayed_job |
| 46 | 43 |
end |
| 47 | 44 |
end |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 |
require 'rubygems' |
| 2 | 2 |
|
| 3 | 3 |
# Set up gems listed in the Gemfile. |
| 4 |
-ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
|
| 4 |
+ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
|
|
| 5 | 5 |
|
| 6 | 6 |
require 'bundler/setup' # Set up gems listed in the Gemfile. |
@@ -1,8 +1,5 @@ |
||
| 1 | 1 |
# Load the rails application |
| 2 |
-require File.expand_path('../application', __FILE__)
|
|
| 3 |
- |
|
| 4 |
-# Remove the XML parser from the list that will be used to initialize the application's XML parser list. |
|
| 5 |
-ActionDispatch::ParamsParser::DEFAULT_PARSERS.delete(Mime::XML) |
|
| 2 |
+require_relative 'application' |
|
| 6 | 3 |
|
| 7 | 4 |
# Initialize the rails application |
| 8 | 5 |
Huginn::Application.initialize! |
@@ -16,9 +16,22 @@ Huginn::Application.configure do |
||
| 16 | 16 |
# Rake tasks automatically ignore this option for performance. |
| 17 | 17 |
config.eager_load = false |
| 18 | 18 |
|
| 19 |
- # Show full error reports and disable caching |
|
| 20 |
- config.consider_all_requests_local = true |
|
| 21 |
- config.action_controller.perform_caching = false |
|
| 19 |
+ # Show full error reports. |
|
| 20 |
+ config.consider_all_requests_local = true |
|
| 21 |
+ |
|
| 22 |
+ # Enable/disable caching. By default caching is disabled. |
|
| 23 |
+ if Rails.root.join('tmp/caching-dev.txt').exist?
|
|
| 24 |
+ config.action_controller.perform_caching = true |
|
| 25 |
+ |
|
| 26 |
+ config.cache_store = :memory_store |
|
| 27 |
+ config.public_file_server.headers = {
|
|
| 28 |
+ 'Cache-Control' => 'public, max-age=172800' |
|
| 29 |
+ } |
|
| 30 |
+ else |
|
| 31 |
+ config.action_controller.perform_caching = false |
|
| 32 |
+ |
|
| 33 |
+ config.cache_store = :null_store |
|
| 34 |
+ end |
|
| 22 | 35 |
|
| 23 | 36 |
# Print deprecation notices to the Rails logger |
| 24 | 37 |
config.active_support.deprecation = :log |
@@ -35,14 +48,8 @@ Huginn::Application.configure do |
||
| 35 | 48 |
# Expands the lines which load the assets |
| 36 | 49 |
config.assets.debug = true |
| 37 | 50 |
|
| 38 |
- # Asset digests allow you to set far-future HTTP expiration dates on all assets, |
|
| 39 |
- # yet still be able to expire them through the digest params. |
|
| 40 |
- config.assets.digest = true |
|
| 41 |
- |
|
| 42 |
- # Adds additional error checking when serving assets at runtime. |
|
| 43 |
- # Checks for improperly declared sprockets dependencies. |
|
| 44 |
- # Raises helpful error messages. |
|
| 45 |
- config.assets.raise_runtime_errors = true |
|
| 51 |
+ # Suppress logger output for asset requests. |
|
| 52 |
+ config.assets.quiet = true |
|
| 46 | 53 |
|
| 47 | 54 |
config.action_mailer.default_url_options = { :host => ENV['DOMAIN'] }
|
| 48 | 55 |
config.action_mailer.asset_host = ENV['DOMAIN'] |
@@ -52,5 +59,10 @@ Huginn::Application.configure do |
||
| 52 | 59 |
else |
| 53 | 60 |
config.action_mailer.delivery_method = :letter_opener_web |
| 54 | 61 |
end |
| 62 |
+ config.action_mailer.perform_caching = false |
|
| 55 | 63 |
# smtp_settings moved to config/initializers/action_mailer.rb |
| 64 |
+ |
|
| 65 |
+ # Use an evented file watcher to asynchronously detect changes in source code, |
|
| 66 |
+ # routes, locales, etc. This feature depends on the listen gem. |
|
| 67 |
+ config.file_watcher = ActiveSupport::EventedFileUpdateChecker |
|
| 56 | 68 |
end |
@@ -14,15 +14,19 @@ Huginn::Application.configure do |
||
| 14 | 14 |
config.consider_all_requests_local = false |
| 15 | 15 |
config.action_controller.perform_caching = true |
| 16 | 16 |
|
| 17 |
- # Enable Rack::Cache to put a simple HTTP cache in front of your application |
|
| 18 |
- # Add `rack-cache` to your Gemfile before enabling this. |
|
| 19 |
- # For large-scale production use, consider using a caching reverse proxy like |
|
| 20 |
- # NGINX, varnish or squid. |
|
| 21 |
- # config.action_dispatch.rack_cache = true |
|
| 22 |
- |
|
| 23 | 17 |
# Disable serving static files from the `/public` folder by default since |
| 24 | 18 |
# Apache or NGINX already handles this. |
| 25 |
- config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? |
|
| 19 |
+ config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? |
|
| 20 |
+ |
|
| 21 |
+ if ENV["RAILS_LOG_TO_STDOUT"].present? || |
|
| 22 |
+ ENV['ON_HEROKU'] || |
|
| 23 |
+ ENV['HEROKU_POSTGRESQL_ROSE_URL'] || |
|
| 24 |
+ ENV['HEROKU_POSTGRESQL_GOLD_URL'] || |
|
| 25 |
+ File.read(File.join(File.dirname(__FILE__), '../../Procfile')) =~ /intended for Heroku/ |
|
| 26 |
+ logger = ActiveSupport::Logger.new(STDOUT) |
|
| 27 |
+ logger.formatter = config.log_formatter |
|
| 28 |
+ config.logger = ActiveSupport::TaggedLogging.new(logger) |
|
| 29 |
+ end |
|
| 26 | 30 |
|
| 27 | 31 |
# Compress JavaScripts and CSS |
| 28 | 32 |
config.assets.js_compressor = :uglifier |
@@ -31,15 +35,17 @@ Huginn::Application.configure do |
||
| 31 | 35 |
# Don't fallback to assets pipeline if a precompiled asset is missed |
| 32 | 36 |
config.assets.compile = false |
| 33 | 37 |
|
| 34 |
- # Generate digests for assets URLs |
|
| 35 |
- config.assets.digest = true |
|
| 36 |
- |
|
| 37 | 38 |
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb |
| 38 | 39 |
|
| 39 | 40 |
# Specifies the header that your server uses for sending files. |
| 40 | 41 |
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache |
| 41 | 42 |
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx |
| 42 | 43 |
|
| 44 |
+ # Mount Action Cable outside main process or domain |
|
| 45 |
+ # config.action_cable.mount_path = nil |
|
| 46 |
+ # config.action_cable.url = 'wss://example.com/cable' |
|
| 47 |
+ # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] |
|
| 48 |
+ |
|
| 43 | 49 |
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. |
| 44 | 50 |
config.force_ssl = ENV['FORCE_SSL'] == 'true' |
| 45 | 51 |
|
@@ -47,7 +53,7 @@ Huginn::Application.configure do |
||
| 47 | 53 |
config.log_level = :info |
| 48 | 54 |
|
| 49 | 55 |
# Prepend all log lines with the following tags |
| 50 |
- config.log_tags = [ :uuid ] # :subdomain |
|
| 56 |
+ config.log_tags = [ :request_id ] # :subdomain |
|
| 51 | 57 |
|
| 52 | 58 |
# Use a different logger for distributed setups |
| 53 | 59 |
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) |
@@ -85,5 +91,6 @@ Huginn::Application.configure do |
||
| 85 | 91 |
config.action_mailer.perform_deliveries = true |
| 86 | 92 |
config.action_mailer.raise_delivery_errors = true |
| 87 | 93 |
config.action_mailer.delivery_method = :smtp |
| 94 |
+ config.action_mailer.perform_caching = false |
|
| 88 | 95 |
# smtp_settings moved to config/initializers/action_mailer.rb |
| 89 | 96 |
end |
@@ -13,8 +13,10 @@ Huginn::Application.configure do |
||
| 13 | 13 |
config.eager_load = false |
| 14 | 14 |
|
| 15 | 15 |
# Configure static asset server for tests with Cache-Control for performance |
| 16 |
- config.serve_static_files = true |
|
| 17 |
- config.static_cache_control = "public, max-age=3600" |
|
| 16 |
+ config.public_file_server.enabled = true |
|
| 17 |
+ config.public_file_server.headers = {
|
|
| 18 |
+ 'Cache-Control' => 'public, max-age=3600' |
|
| 19 |
+ } |
|
| 18 | 20 |
|
| 19 | 21 |
# Show full error reports and disable caching |
| 20 | 22 |
config.consider_all_requests_local = true |
@@ -25,6 +27,7 @@ Huginn::Application.configure do |
||
| 25 | 27 |
|
| 26 | 28 |
# Disable request forgery protection in test environment |
| 27 | 29 |
config.action_controller.allow_forgery_protection = false |
| 30 |
+ config.action_mailer.perform_caching = false |
|
| 28 | 31 |
|
| 29 | 32 |
# Tell Action Mailer not to deliver emails to the real world. |
| 30 | 33 |
# The :test delivery method accumulates sent emails in the |
@@ -36,9 +39,6 @@ Huginn::Application.configure do |
||
| 36 | 39 |
# Raise exception for unpermitted parameters |
| 37 | 40 |
config.action_controller.action_on_unpermitted_parameters = :raise |
| 38 | 41 |
|
| 39 |
- # Randomize the order test cases are executed. |
|
| 40 |
- config.active_support.test_order = :random |
|
| 41 |
- |
|
| 42 | 42 |
# Print deprecation notices to the stderr |
| 43 | 43 |
config.active_support.deprecation = :stderr |
| 44 | 44 |
|
@@ -0,0 +1,5 @@ |
||
| 1 |
+# Be sure to restart your server when you modify this file. |
|
| 2 |
+ |
|
| 3 |
+# Specify a serializer for the signed and encrypted cookie jars. |
|
| 4 |
+# Valid options are :json, :marshal, and :hybrid. |
|
| 5 |
+Rails.application.config.action_dispatch.cookies_serializer = :hybrid |
@@ -0,0 +1,24 @@ |
||
| 1 |
+# Be sure to restart your server when you modify this file. |
|
| 2 |
+# |
|
| 3 |
+# This file contains migration options to ease your Rails 5.0 upgrade. |
|
| 4 |
+# |
|
| 5 |
+# Read the Rails 5.0 release notes for more info on each option. |
|
| 6 |
+ |
|
| 7 |
+# Enable per-form CSRF tokens. Previous versions had false. |
|
| 8 |
+Rails.application.config.action_controller.per_form_csrf_tokens = true |
|
| 9 |
+ |
|
| 10 |
+# Enable origin-checking CSRF mitigation. Previous versions had false. |
|
| 11 |
+Rails.application.config.action_controller.forgery_protection_origin_check = true |
|
| 12 |
+ |
|
| 13 |
+# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`. |
|
| 14 |
+# Previous versions had false. |
|
| 15 |
+ActiveSupport.to_time_preserves_timezone = true |
|
| 16 |
+ |
|
| 17 |
+# Require `belongs_to` associations by default. Previous versions had false. |
|
| 18 |
+Rails.application.config.active_record.belongs_to_required_by_default = true |
|
| 19 |
+ |
|
| 20 |
+# Do not halt callback chains when a callback returns false. Previous versions had true. |
|
| 21 |
+ActiveSupport.halt_callback_chains_on_return_false = false |
|
| 22 |
+ |
|
| 23 |
+# Configure SSL options to enable HSTS with subdomains. Previous versions had false. |
|
| 24 |
+Rails.application.config.ssl_options = { hsts: { subdomains: true } }
|
@@ -1,10 +1,9 @@ |
||
| 1 |
-Rails::Rack::Logger.class_eval do |
|
| 2 |
- def call_with_silence_worker_status(env) |
|
| 3 |
- previous_level = Rails.logger.level |
|
| 4 |
- Rails.logger.level = Logger::ERROR if env['PATH_INFO'] =~ %r{^/worker_status}
|
|
| 5 |
- call_without_silence_worker_status(env) |
|
| 6 |
- ensure |
|
| 7 |
- Rails.logger.level = previous_level |
|
| 1 |
+module SilencedLogger |
|
| 2 |
+ def call(env) |
|
| 3 |
+ return super(env) if env['PATH_INFO'] !~ %r{^/worker_status}
|
|
| 4 |
+ Rails.logger.silence(Logger::ERROR) do |
|
| 5 |
+ super(env) |
|
| 6 |
+ end |
|
| 8 | 7 |
end |
| 9 |
- alias_method_chain :call, :silence_worker_status |
|
| 10 | 8 |
end |
| 9 |
+Rails::Rack::Logger.send(:prepend, SilencedLogger) |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 |
|
| 6 | 6 |
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. |
| 7 | 7 |
ActiveSupport.on_load(:action_controller) do |
| 8 |
- wrap_parameters format: [:json] if respond_to?(:wrap_parameters) |
|
| 8 |
+ wrap_parameters format: [:json] |
|
| 9 | 9 |
end |
| 10 | 10 |
|
| 11 | 11 |
# To enable root element in JSON for ActiveRecord objects. |
@@ -0,0 +1,6 @@ |
||
| 1 |
+%w( |
|
| 2 |
+ .ruby-version |
|
| 3 |
+ .rbenv-vars |
|
| 4 |
+ tmp/restart.txt |
|
| 5 |
+ tmp/caching-dev.txt |
|
| 6 |
+).each { |path| Spring.watch(path) }
|
@@ -1,3 +1,5 @@ |
||
| 1 |
+require 'liquid_migrator' |
|
| 2 |
+ |
|
| 1 | 3 |
class MigrateAgentsToLiquidTemplating < ActiveRecord::Migration |
| 2 | 4 |
class Agent < ActiveRecord::Base |
| 3 | 5 |
include JSONSerializedField |
@@ -43,7 +43,7 @@ grep = /app/.env.example | sed -e 's/^#\([^ ]\)/\1/' | grep -v -e '^#' | \ |
||
| 43 | 43 |
|
| 44 | 44 |
eval "echo RAILS_ENV=${RAILS_ENV}" >> .env
|
| 45 | 45 |
eval "echo START_MYSQL=${START_MYSQL}" >> .env
|
| 46 |
-echo "ON_HEROKU=true" >> .env |
|
| 46 |
+echo "RAILS_LOG_TO_STDOUT=true" >> .env |
|
| 47 | 47 |
echo "RAILS_SERVE_STATIC_FILES=true" >> .env |
| 48 | 48 |
|
| 49 | 49 |
chmod ugo+r /app/.env |
@@ -27,7 +27,7 @@ $minimal_apt_get_install build-essential checkinstall git-core \ |
||
| 27 | 27 |
libncurses5-dev libffi-dev libxml2-dev libxslt-dev libcurl4-openssl-dev libicu-dev \ |
| 28 | 28 |
graphviz libgraphviz-dev \ |
| 29 | 29 |
libmysqlclient-dev libpq-dev libsqlite3-dev \ |
| 30 |
- ruby2.2 ruby2.2-dev |
|
| 30 |
+ ruby2.3 ruby2.3-dev |
|
| 31 | 31 |
locale-gen en_US.UTF-8 |
| 32 | 32 |
update-locale LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 |
| 33 | 33 |
gem install --no-ri --no-rdoc bundler |
@@ -29,7 +29,7 @@ grep = /app/.env.example | sed -e 's/^#\([^ ]\)/\1/' | grep -v -e '^#' | \ |
||
| 29 | 29 |
|
| 30 | 30 |
eval "echo PORT=${PORT:-${PORT:-3000}}" >> .env
|
| 31 | 31 |
eval "echo RAILS_ENV=${RAILS_ENV:-${RAILS_ENV:-production}}" >> .env
|
| 32 |
-eval "echo ON_HEROKU=true" >> .env |
|
| 32 |
+eval "echo RAILS_LOG_TO_STDOUT=true" >> .env |
|
| 33 | 33 |
eval "echo RAILS_SERVE_STATIC_FILES=true" >> .env |
| 34 | 34 |
|
| 35 | 35 |
chmod ugo+r /app/.env |
@@ -6,8 +6,8 @@ describe Admin::UsersController do |
||
| 6 | 6 |
it 'imports the default scenario for the new user' do |
| 7 | 7 |
mock(DefaultScenarioImporter).import(is_a(User)) |
| 8 | 8 |
sign_in users(:jane) |
| 9 |
- post :create, :user => {username: 'jdoe', email: 'jdoe@example.com',
|
|
| 10 |
- password: 's3cr3t55', password_confirmation: 's3cr3t55', admin: false } |
|
| 9 |
+ post :create, params: {:user => {username: 'jdoe', email: 'jdoe@example.com',
|
|
| 10 |
+ password: 's3cr3t55', password_confirmation: 's3cr3t55', admin: false }} |
|
| 11 | 11 |
end |
| 12 | 12 |
end |
| 13 | 13 |
|
@@ -15,7 +15,7 @@ describe Admin::UsersController do |
||
| 15 | 15 |
it 'does not import the default scenario' do |
| 16 | 16 |
stub(DefaultScenarioImporter).import(is_a(User)) { fail "Should not attempt import" }
|
| 17 | 17 |
sign_in users(:jane) |
| 18 |
- post :create, :user => {username: 'user'}
|
|
| 18 |
+ post :create, params: {:user => {username: 'user'}}
|
|
| 19 | 19 |
end |
| 20 | 20 |
end |
| 21 | 21 |
end |
@@ -24,7 +24,7 @@ describe Admin::UsersController do |
||
| 24 | 24 |
it "switches to another user" do |
| 25 | 25 |
sign_in users(:jane) |
| 26 | 26 |
|
| 27 |
- get :switch_to_user, :id => users(:bob).id |
|
| 27 |
+ get :switch_to_user, params: {:id => users(:bob).id}
|
|
| 28 | 28 |
expect(response).to redirect_to(agents_path) |
| 29 | 29 |
expect(subject.session[:original_admin_user_id]).to eq(users(:jane).id) |
| 30 | 30 |
end |
@@ -32,7 +32,7 @@ describe Admin::UsersController do |
||
| 32 | 32 |
it "does not switch if not admin" do |
| 33 | 33 |
sign_in users(:bob) |
| 34 | 34 |
|
| 35 |
- get :switch_to_user, :id => users(:jane).id |
|
| 35 |
+ get :switch_to_user, params: {:id => users(:jane).id}
|
|
| 36 | 36 |
expect(response).to redirect_to(root_path) |
| 37 | 37 |
end |
| 38 | 38 |
end |
@@ -41,7 +41,7 @@ describe Admin::UsersController do |
||
| 41 | 41 |
it "switches to another user and back" do |
| 42 | 42 |
sign_in users(:jane) |
| 43 | 43 |
|
| 44 |
- get :switch_to_user, :id => users(:bob).id |
|
| 44 |
+ get :switch_to_user, params: {:id => users(:bob).id}
|
|
| 45 | 45 |
expect(response).to redirect_to(agents_path) |
| 46 | 46 |
expect(subject.session[:original_admin_user_id]).to eq(users(:jane).id) |
| 47 | 47 |
|
@@ -16,7 +16,7 @@ describe Agents::DryRunsController do |
||
| 16 | 16 |
|
| 17 | 17 |
describe "GET index" do |
| 18 | 18 |
it "does not load any events without specifing sources" do |
| 19 |
- get :index, type: 'Agents::WebsiteAgent', source_ids: [] |
|
| 19 |
+ get :index, params: {type: 'Agents::WebsiteAgent', source_ids: []}
|
|
| 20 | 20 |
expect(assigns(:events)).to eq([]) |
| 21 | 21 |
end |
| 22 | 22 |
|
@@ -29,13 +29,13 @@ describe Agents::DryRunsController do |
||
| 29 | 29 |
end |
| 30 | 30 |
|
| 31 | 31 |
it "for new agents" do |
| 32 |
- get :index, type: 'Agents::WebsiteAgent', source_ids: [@agent.id] |
|
| 32 |
+ get :index, params: {type: 'Agents::WebsiteAgent', source_ids: [@agent.id]}
|
|
| 33 | 33 |
expect(assigns(:events)).to eq([]) |
| 34 | 34 |
end |
| 35 | 35 |
|
| 36 | 36 |
it "for existing agents" do |
| 37 | 37 |
expect(@agent.events.count).not_to be(0) |
| 38 |
- expect { get :index, agent_id: @agent }.to raise_error(NoMethodError)
|
|
| 38 |
+ expect { get :index, params: {agent_id: @agent} }.to raise_error(NoMethodError)
|
|
| 39 | 39 |
end |
| 40 | 40 |
end |
| 41 | 41 |
|
@@ -47,12 +47,12 @@ describe Agents::DryRunsController do |
||
| 47 | 47 |
end |
| 48 | 48 |
|
| 49 | 49 |
it "load the most recent events when providing source ids" do |
| 50 |
- get :index, type: 'Agents::WebsiteAgent', source_ids: [@agent.id] |
|
| 50 |
+ get :index, params: {type: 'Agents::WebsiteAgent', source_ids: [@agent.id]}
|
|
| 51 | 51 |
expect(assigns(:events)).to eq([@agent.events.first]) |
| 52 | 52 |
end |
| 53 | 53 |
|
| 54 | 54 |
it "loads the most recent events for a saved agent" do |
| 55 |
- get :index, agent_id: @agent |
|
| 55 |
+ get :index, params: {agent_id: @agent}
|
|
| 56 | 56 |
expect(assigns(:events)).to eq([@agent.events.first]) |
| 57 | 57 |
end |
| 58 | 58 |
end |
@@ -65,7 +65,7 @@ describe Agents::DryRunsController do |
||
| 65 | 65 |
|
| 66 | 66 |
it "does not actually create any agent, event or log" do |
| 67 | 67 |
expect {
|
| 68 |
- post :create, agent: valid_attributes |
|
| 68 |
+ post :create, params: {agent: valid_attributes}
|
|
| 69 | 69 |
}.not_to change {
|
| 70 | 70 |
[users(:bob).agents.count, users(:bob).events.count, users(:bob).logs.count] |
| 71 | 71 |
} |
@@ -81,7 +81,7 @@ describe Agents::DryRunsController do |
||
| 81 | 81 |
it "does not actually update an agent" do |
| 82 | 82 |
agent = agents(:bob_weather_agent) |
| 83 | 83 |
expect {
|
| 84 |
- post :create, agent_id: agent, agent: valid_attributes(name: 'New Name') |
|
| 84 |
+ post :create, params: {agent_id: agent, agent: valid_attributes(name: 'New Name')}
|
|
| 85 | 85 |
}.not_to change {
|
| 86 | 86 |
[users(:bob).agents.count, users(:bob).events.count, users(:bob).logs.count, agent.name, agent.updated_at] |
| 87 | 87 |
} |
@@ -93,7 +93,7 @@ describe Agents::DryRunsController do |
||
| 93 | 93 |
agent.save! |
| 94 | 94 |
url_from_event = "http://xkcd.com/?from_event=1".freeze |
| 95 | 95 |
expect {
|
| 96 |
- post :create, agent_id: agent, event: { url: url_from_event }
|
|
| 96 |
+ post :create, params: {agent_id: agent, event: { url: url_from_event }.to_json}
|
|
| 97 | 97 |
}.not_to change {
|
| 98 | 98 |
[users(:bob).agents.count, users(:bob).events.count, users(:bob).logs.count, agent.name, agent.updated_at] |
| 99 | 99 |
} |
@@ -112,7 +112,7 @@ describe Agents::DryRunsController do |
||
| 112 | 112 |
agent.memory = {fu: "bar"}
|
| 113 | 113 |
agent.user = users(:bob) |
| 114 | 114 |
agent.save! |
| 115 |
- post :create, agent_id: agent, agent: valid_params |
|
| 115 |
+ post :create, params: {agent_id: agent, agent: valid_params}
|
|
| 116 | 116 |
results = assigns(:results) |
| 117 | 117 |
expect(results[:events][0]).to eql({"message" => "bar"})
|
| 118 | 118 |
end |
@@ -29,7 +29,7 @@ describe AgentsController do |
||
| 29 | 29 |
describe "POST handle_details_post" do |
| 30 | 30 |
it "passes control to handle_details_post on the agent" do |
| 31 | 31 |
sign_in users(:bob) |
| 32 |
- post :handle_details_post, :id => agents(:bob_manual_event_agent).to_param, :payload => { :foo => "bar" }.to_json
|
|
| 32 |
+ post :handle_details_post, params: {:id => agents(:bob_manual_event_agent).to_param, :payload => { :foo => "bar" }.to_json}
|
|
| 33 | 33 |
expect(JSON.parse(response.body)).to eq({ "success" => true })
|
| 34 | 34 |
expect(agents(:bob_manual_event_agent).events.last.payload).to eq({ 'foo' => "bar" })
|
| 35 | 35 |
end |
@@ -37,7 +37,7 @@ describe AgentsController do |
||
| 37 | 37 |
it "can only be accessed by the Agent's owner" do |
| 38 | 38 |
sign_in users(:jane) |
| 39 | 39 |
expect {
|
| 40 |
- post :handle_details_post, :id => agents(:bob_manual_event_agent).to_param, :payload => { :foo => :bar }.to_json
|
|
| 40 |
+ post :handle_details_post, params: {:id => agents(:bob_manual_event_agent).to_param, :payload => { :foo => :bar }.to_json}
|
|
| 41 | 41 |
}.to raise_error(ActiveRecord::RecordNotFound) |
| 42 | 42 |
end |
| 43 | 43 |
end |
@@ -46,13 +46,13 @@ describe AgentsController do |
||
| 46 | 46 |
it "triggers Agent.async_check with the Agent's ID" do |
| 47 | 47 |
sign_in users(:bob) |
| 48 | 48 |
mock(Agent).async_check(agents(:bob_manual_event_agent).id) |
| 49 |
- post :run, :id => agents(:bob_manual_event_agent).to_param |
|
| 49 |
+ post :run, params: {:id => agents(:bob_manual_event_agent).to_param}
|
|
| 50 | 50 |
end |
| 51 | 51 |
|
| 52 | 52 |
it "can only be accessed by the Agent's owner" do |
| 53 | 53 |
sign_in users(:jane) |
| 54 | 54 |
expect {
|
| 55 |
- post :run, :id => agents(:bob_manual_event_agent).to_param |
|
| 55 |
+ post :run, params: {:id => agents(:bob_manual_event_agent).to_param}
|
|
| 56 | 56 |
}.to raise_error(ActiveRecord::RecordNotFound) |
| 57 | 57 |
end |
| 58 | 58 |
end |
@@ -62,7 +62,7 @@ describe AgentsController do |
||
| 62 | 62 |
sign_in users(:bob) |
| 63 | 63 |
agent_event = events(:bob_website_agent_event).id |
| 64 | 64 |
other_event = events(:jane_website_agent_event).id |
| 65 |
- post :remove_events, :id => agents(:bob_website_agent).to_param |
|
| 65 |
+ post :remove_events, params: {:id => agents(:bob_website_agent).to_param}
|
|
| 66 | 66 |
expect(Event.where(:id => agent_event).count).to eq(0) |
| 67 | 67 |
expect(Event.where(:id => other_event).count).to eq(1) |
| 68 | 68 |
end |
@@ -70,7 +70,7 @@ describe AgentsController do |
||
| 70 | 70 |
it "can only be accessed by the Agent's owner" do |
| 71 | 71 |
sign_in users(:jane) |
| 72 | 72 |
expect {
|
| 73 |
- post :remove_events, :id => agents(:bob_website_agent).to_param |
|
| 73 |
+ post :remove_events, params: {:id => agents(:bob_website_agent).to_param}
|
|
| 74 | 74 |
}.to raise_error(ActiveRecord::RecordNotFound) |
| 75 | 75 |
end |
| 76 | 76 |
end |
@@ -110,11 +110,11 @@ describe AgentsController do |
||
| 110 | 110 |
describe "GET show" do |
| 111 | 111 |
it "only shows Agents for the current user" do |
| 112 | 112 |
sign_in users(:bob) |
| 113 |
- get :show, :id => agents(:bob_website_agent).to_param |
|
| 113 |
+ get :show, params: {:id => agents(:bob_website_agent).to_param}
|
|
| 114 | 114 |
expect(assigns(:agent)).to eq(agents(:bob_website_agent)) |
| 115 | 115 |
|
| 116 | 116 |
expect {
|
| 117 |
- get :show, :id => agents(:jane_website_agent).to_param |
|
| 117 |
+ get :show, params: {:id => agents(:jane_website_agent).to_param}
|
|
| 118 | 118 |
}.to raise_error(ActiveRecord::RecordNotFound) |
| 119 | 119 |
end |
| 120 | 120 |
end |
@@ -123,7 +123,7 @@ describe AgentsController do |
||
| 123 | 123 |
describe "with :id" do |
| 124 | 124 |
it "opens a clone of a given Agent" do |
| 125 | 125 |
sign_in users(:bob) |
| 126 |
- get :new, :id => agents(:bob_website_agent).to_param |
|
| 126 |
+ get :new, params: {:id => agents(:bob_website_agent).to_param}
|
|
| 127 | 127 |
expect(assigns(:agent).attributes).to eq(users(:bob).agents.build_clone(agents(:bob_website_agent)).attributes) |
| 128 | 128 |
end |
| 129 | 129 |
|
@@ -131,7 +131,7 @@ describe AgentsController do |
||
| 131 | 131 |
sign_in users(:bob) |
| 132 | 132 |
|
| 133 | 133 |
expect {
|
| 134 |
- get :new, :id => agents(:jane_website_agent).to_param |
|
| 134 |
+ get :new, params: {:id => agents(:jane_website_agent).to_param}
|
|
| 135 | 135 |
}.to raise_error(ActiveRecord::RecordNotFound) |
| 136 | 136 |
end |
| 137 | 137 |
end |
@@ -139,13 +139,13 @@ describe AgentsController do |
||
| 139 | 139 |
describe "with a scenario_id" do |
| 140 | 140 |
it 'populates the assigned agent with the scenario' do |
| 141 | 141 |
sign_in users(:bob) |
| 142 |
- get :new, :scenario_id => scenarios(:bob_weather).id |
|
| 142 |
+ get :new, params: {:scenario_id => scenarios(:bob_weather).id}
|
|
| 143 | 143 |
expect(assigns(:agent).scenario_ids).to eq([scenarios(:bob_weather).id]) |
| 144 | 144 |
end |
| 145 | 145 |
|
| 146 | 146 |
it "does not see other user's scenarios" do |
| 147 | 147 |
sign_in users(:bob) |
| 148 |
- get :new, :scenario_id => scenarios(:jane_weather).id |
|
| 148 |
+ get :new, params: {:scenario_id => scenarios(:jane_weather).id}
|
|
| 149 | 149 |
expect(assigns(:agent).scenario_ids).to eq([]) |
| 150 | 150 |
end |
| 151 | 151 |
end |
@@ -154,11 +154,11 @@ describe AgentsController do |
||
| 154 | 154 |
describe "GET edit" do |
| 155 | 155 |
it "only shows Agents for the current user" do |
| 156 | 156 |
sign_in users(:bob) |
| 157 |
- get :edit, :id => agents(:bob_website_agent).to_param |
|
| 157 |
+ get :edit, params: {:id => agents(:bob_website_agent).to_param}
|
|
| 158 | 158 |
expect(assigns(:agent)).to eq(agents(:bob_website_agent)) |
| 159 | 159 |
|
| 160 | 160 |
expect {
|
| 161 |
- get :edit, :id => agents(:jane_website_agent).to_param |
|
| 161 |
+ get :edit, params: {:id => agents(:jane_website_agent).to_param}
|
|
| 162 | 162 |
}.to raise_error(ActiveRecord::RecordNotFound) |
| 163 | 163 |
end |
| 164 | 164 |
end |
@@ -167,27 +167,27 @@ describe AgentsController do |
||
| 167 | 167 |
it "errors on bad types" do |
| 168 | 168 |
sign_in users(:bob) |
| 169 | 169 |
expect {
|
| 170 |
- post :create, :agent => valid_attributes(:type => "Agents::ThisIsFake") |
|
| 170 |
+ post :create, params: {:agent => valid_attributes(:type => "Agents::ThisIsFake")}
|
|
| 171 | 171 |
}.not_to change { users(:bob).agents.count }
|
| 172 | 172 |
expect(assigns(:agent)).to be_a(Agent) |
| 173 | 173 |
expect(assigns(:agent)).to have(1).error_on(:type) |
| 174 | 174 |
|
| 175 | 175 |
sign_in users(:bob) |
| 176 | 176 |
expect {
|
| 177 |
- post :create, :agent => valid_attributes(:type => "Object") |
|
| 177 |
+ post :create, params: {:agent => valid_attributes(:type => "Object")}
|
|
| 178 | 178 |
}.not_to change { users(:bob).agents.count }
|
| 179 | 179 |
expect(assigns(:agent)).to be_a(Agent) |
| 180 | 180 |
expect(assigns(:agent)).to have(1).error_on(:type) |
| 181 | 181 |
sign_in users(:bob) |
| 182 | 182 |
|
| 183 | 183 |
expect {
|
| 184 |
- post :create, :agent => valid_attributes(:type => "Agent") |
|
| 184 |
+ post :create, params: {:agent => valid_attributes(:type => "Agent")}
|
|
| 185 | 185 |
}.not_to change { users(:bob).agents.count }
|
| 186 | 186 |
expect(assigns(:agent)).to be_a(Agent) |
| 187 | 187 |
expect(assigns(:agent)).to have(1).error_on(:type) |
| 188 | 188 |
|
| 189 | 189 |
expect {
|
| 190 |
- post :create, :agent => valid_attributes(:type => "User") |
|
| 190 |
+ post :create, params: {:agent => valid_attributes(:type => "User")}
|
|
| 191 | 191 |
}.not_to change { users(:bob).agents.count }
|
| 192 | 192 |
expect(assigns(:agent)).to be_a(Agent) |
| 193 | 193 |
expect(assigns(:agent)).to have(1).error_on(:type) |
@@ -197,7 +197,7 @@ describe AgentsController do |
||
| 197 | 197 |
sign_in users(:bob) |
| 198 | 198 |
expect {
|
| 199 | 199 |
expect {
|
| 200 |
- post :create, :agent => valid_attributes |
|
| 200 |
+ post :create, params: {:agent => valid_attributes}
|
|
| 201 | 201 |
}.to change { users(:bob).agents.count }.by(1)
|
| 202 | 202 |
}.to change { Link.count }.by(1)
|
| 203 | 203 |
expect(assigns(:agent)).to be_a(Agents::WebsiteAgent) |
@@ -209,7 +209,7 @@ describe AgentsController do |
||
| 209 | 209 |
attributes[:receiver_ids] = attributes[:source_ids] |
| 210 | 210 |
expect {
|
| 211 | 211 |
expect {
|
| 212 |
- post :create, :agent => attributes |
|
| 212 |
+ post :create, params: {:agent => attributes}
|
|
| 213 | 213 |
}.to change { users(:bob).agents.count }.by(1)
|
| 214 | 214 |
}.to change { Link.count }.by(2)
|
| 215 | 215 |
expect(assigns(:agent)).to be_a(Agents::WebsiteAgent) |
@@ -218,7 +218,7 @@ describe AgentsController do |
||
| 218 | 218 |
it "shows errors" do |
| 219 | 219 |
sign_in users(:bob) |
| 220 | 220 |
expect {
|
| 221 |
- post :create, :agent => valid_attributes(:name => "") |
|
| 221 |
+ post :create, params: {:agent => valid_attributes(:name => "")}
|
|
| 222 | 222 |
}.not_to change { users(:bob).agents.count }
|
| 223 | 223 |
expect(assigns(:agent)).to have(1).errors_on(:name) |
| 224 | 224 |
expect(response).to render_template("new")
|
@@ -228,7 +228,7 @@ describe AgentsController do |
||
| 228 | 228 |
sign_in users(:bob) |
| 229 | 229 |
expect {
|
| 230 | 230 |
expect {
|
| 231 |
- post :create, :agent => valid_attributes(:source_ids => [agents(:jane_weather_agent).id]) |
|
| 231 |
+ post :create, params: {:agent => valid_attributes(:source_ids => [agents(:jane_weather_agent).id])}
|
|
| 232 | 232 |
}.not_to change { users(:bob).agents.count }
|
| 233 | 233 |
}.not_to change { Link.count }
|
| 234 | 234 |
end |
@@ -237,25 +237,25 @@ describe AgentsController do |
||
| 237 | 237 |
describe "PUT update" do |
| 238 | 238 |
it "does not allow changing types" do |
| 239 | 239 |
sign_in users(:bob) |
| 240 |
- post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:type => "Agents::WeatherAgent") |
|
| 240 |
+ post :update, params: {:id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:type => "Agents::WeatherAgent")}
|
|
| 241 | 241 |
expect(assigns(:agent)).to have(1).errors_on(:type) |
| 242 | 242 |
expect(response).to render_template("edit")
|
| 243 | 243 |
end |
| 244 | 244 |
|
| 245 | 245 |
it "updates attributes on Agents for the current user" do |
| 246 | 246 |
sign_in users(:bob) |
| 247 |
- post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name") |
|
| 247 |
+ post :update, params: {:id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name")}
|
|
| 248 | 248 |
expect(response).to redirect_to(agents_path) |
| 249 | 249 |
expect(agents(:bob_website_agent).reload.name).to eq("New name")
|
| 250 | 250 |
|
| 251 | 251 |
expect {
|
| 252 |
- post :update, :id => agents(:jane_website_agent).to_param, :agent => valid_attributes(:name => "New name") |
|
| 252 |
+ post :update, params: {:id => agents(:jane_website_agent).to_param, :agent => valid_attributes(:name => "New name")}
|
|
| 253 | 253 |
}.to raise_error(ActiveRecord::RecordNotFound) |
| 254 | 254 |
end |
| 255 | 255 |
|
| 256 | 256 |
it "accepts JSON requests" do |
| 257 | 257 |
sign_in users(:bob) |
| 258 |
- post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name"), :format => :json |
|
| 258 |
+ post :update, params: {:id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name")}, :format => :json
|
|
| 259 | 259 |
expect(agents(:bob_website_agent).reload.name).to eq("New name")
|
| 260 | 260 |
expect(JSON.parse(response.body)['name']).to eq("New name")
|
| 261 | 261 |
expect(response).to be_success |
@@ -263,19 +263,19 @@ describe AgentsController do |
||
| 263 | 263 |
|
| 264 | 264 |
it "will not accept Agent sources owned by other users" do |
| 265 | 265 |
sign_in users(:bob) |
| 266 |
- post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:source_ids => [agents(:jane_weather_agent).id]) |
|
| 266 |
+ post :update, params: {:id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:source_ids => [agents(:jane_weather_agent).id])}
|
|
| 267 | 267 |
expect(assigns(:agent)).to have(1).errors_on(:sources) |
| 268 | 268 |
end |
| 269 | 269 |
|
| 270 | 270 |
it "will not accept Scenarios owned by other users" do |
| 271 | 271 |
sign_in users(:bob) |
| 272 |
- post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:scenario_ids => [scenarios(:jane_weather).id]) |
|
| 272 |
+ post :update, params: {:id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:scenario_ids => [scenarios(:jane_weather).id])}
|
|
| 273 | 273 |
expect(assigns(:agent)).to have(1).errors_on(:scenarios) |
| 274 | 274 |
end |
| 275 | 275 |
|
| 276 | 276 |
it "shows errors" do |
| 277 | 277 |
sign_in users(:bob) |
| 278 |
- post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "") |
|
| 278 |
+ post :update, params: {:id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "")}
|
|
| 279 | 279 |
expect(assigns(:agent)).to have(1).errors_on(:name) |
| 280 | 280 |
expect(response).to render_template("edit")
|
| 281 | 281 |
end |
@@ -283,7 +283,7 @@ describe AgentsController do |
||
| 283 | 283 |
it 'does not allow to modify the agents user_id' do |
| 284 | 284 |
sign_in users(:bob) |
| 285 | 285 |
expect {
|
| 286 |
- post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:user_id => users(:jane).id) |
|
| 286 |
+ post :update, params: {:id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:user_id => users(:jane).id)}
|
|
| 287 | 287 |
}.to raise_error(ActionController::UnpermittedParameters) |
| 288 | 288 |
end |
| 289 | 289 |
|
@@ -293,28 +293,28 @@ describe AgentsController do |
||
| 293 | 293 |
end |
| 294 | 294 |
|
| 295 | 295 |
it "can redirect back to the show path" do |
| 296 |
- post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name"), :return => "show" |
|
| 296 |
+ post :update, params: {:id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name"), :return => "show"}
|
|
| 297 | 297 |
expect(response).to redirect_to(agent_path(agents(:bob_website_agent))) |
| 298 | 298 |
end |
| 299 | 299 |
|
| 300 | 300 |
it "redirect back to the index path by default" do |
| 301 |
- post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name") |
|
| 301 |
+ post :update, params: {:id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name")}
|
|
| 302 | 302 |
expect(response).to redirect_to(agents_path) |
| 303 | 303 |
end |
| 304 | 304 |
|
| 305 | 305 |
it "accepts return paths to scenarios" do |
| 306 |
- post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name"), :return => "/scenarios/2" |
|
| 306 |
+ post :update, params: {:id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name"), :return => "/scenarios/2"}
|
|
| 307 | 307 |
expect(response).to redirect_to("/scenarios/2")
|
| 308 | 308 |
end |
| 309 | 309 |
|
| 310 | 310 |
it "sanitizes return paths" do |
| 311 |
- post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name"), :return => "/scenar" |
|
| 311 |
+ post :update, params: {:id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name"), :return => "/scenar"}
|
|
| 312 | 312 |
expect(response).to redirect_to(agents_path) |
| 313 | 313 |
|
| 314 |
- post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name"), :return => "http://google.com" |
|
| 314 |
+ post :update, params: {:id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name"), :return => "http://google.com"}
|
|
| 315 | 315 |
expect(response).to redirect_to(agents_path) |
| 316 | 316 |
|
| 317 |
- post :update, :id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name"), :return => "javascript:alert(1)" |
|
| 317 |
+ post :update, params: {:id => agents(:bob_website_agent).to_param, :agent => valid_attributes(:name => "New name"), :return => "javascript:alert(1)"}
|
|
| 318 | 318 |
expect(response).to redirect_to(agents_path) |
| 319 | 319 |
end |
| 320 | 320 |
end |
@@ -325,7 +325,7 @@ describe AgentsController do |
||
| 325 | 325 |
agent.disabled = true |
| 326 | 326 |
agent.last_checked_event_id = nil |
| 327 | 327 |
agent.save! |
| 328 |
- post :update, id: agents(:bob_website_agent).to_param, agent: { disabled: 'false', drop_pending_events: 'true' }
|
|
| 328 |
+ post :update, params: {id: agents(:bob_website_agent).to_param, agent: { disabled: 'false', drop_pending_events: 'true' }}
|
|
| 329 | 329 |
agent.reload |
| 330 | 330 |
expect(agent.disabled).to eq(false) |
| 331 | 331 |
expect(agent.last_checked_event_id).to eq(Event.maximum(:id)) |
@@ -337,13 +337,13 @@ describe AgentsController do |
||
| 337 | 337 |
sign_in users(:bob) |
| 338 | 338 |
|
| 339 | 339 |
expect(agents(:bob_weather_agent).scenarios).to include(scenarios(:bob_weather)) |
| 340 |
- put :leave_scenario, :id => agents(:bob_weather_agent).to_param, :scenario_id => scenarios(:bob_weather).to_param |
|
| 340 |
+ put :leave_scenario, params: {:id => agents(:bob_weather_agent).to_param, :scenario_id => scenarios(:bob_weather).to_param}
|
|
| 341 | 341 |
expect(agents(:bob_weather_agent).scenarios).not_to include(scenarios(:bob_weather)) |
| 342 | 342 |
|
| 343 | 343 |
expect(Scenario.where(:id => scenarios(:bob_weather).id)).to exist |
| 344 | 344 |
|
| 345 | 345 |
expect {
|
| 346 |
- put :leave_scenario, :id => agents(:jane_weather_agent).to_param, :scenario_id => scenarios(:jane_weather).to_param |
|
| 346 |
+ put :leave_scenario, params: {:id => agents(:jane_weather_agent).to_param, :scenario_id => scenarios(:jane_weather).to_param}
|
|
| 347 | 347 |
}.to raise_error(ActiveRecord::RecordNotFound) |
| 348 | 348 |
end |
| 349 | 349 |
end |
@@ -352,25 +352,25 @@ describe AgentsController do |
||
| 352 | 352 |
it "destroys only Agents owned by the current user" do |
| 353 | 353 |
sign_in users(:bob) |
| 354 | 354 |
expect {
|
| 355 |
- delete :destroy, :id => agents(:bob_website_agent).to_param |
|
| 355 |
+ delete :destroy, params: {:id => agents(:bob_website_agent).to_param}
|
|
| 356 | 356 |
}.to change(Agent, :count).by(-1) |
| 357 | 357 |
|
| 358 | 358 |
expect {
|
| 359 |
- delete :destroy, :id => agents(:jane_website_agent).to_param |
|
| 359 |
+ delete :destroy, params: {:id => agents(:jane_website_agent).to_param}
|
|
| 360 | 360 |
}.to raise_error(ActiveRecord::RecordNotFound) |
| 361 | 361 |
end |
| 362 | 362 |
|
| 363 | 363 |
it "redirects correctly when the Agent is deleted from the Agent itself" do |
| 364 | 364 |
sign_in users(:bob) |
| 365 | 365 |
|
| 366 |
- delete :destroy, :id => agents(:bob_website_agent).to_param |
|
| 366 |
+ delete :destroy, params: {:id => agents(:bob_website_agent).to_param}
|
|
| 367 | 367 |
expect(response).to redirect_to agents_path |
| 368 | 368 |
end |
| 369 | 369 |
|
| 370 | 370 |
it "redirects correctly when the Agent is deleted from a Scenario" do |
| 371 | 371 |
sign_in users(:bob) |
| 372 | 372 |
|
| 373 |
- delete :destroy, :id => agents(:bob_weather_agent).to_param, :return => scenario_path(scenarios(:bob_weather)).to_param |
|
| 373 |
+ delete :destroy, params: {:id => agents(:bob_weather_agent).to_param, :return => scenario_path(scenarios(:bob_weather)).to_param}
|
|
| 374 | 374 |
expect(response).to redirect_to scenario_path(scenarios(:bob_weather)) |
| 375 | 375 |
end |
| 376 | 376 |
end |
@@ -387,7 +387,7 @@ describe AgentsController do |
||
| 387 | 387 |
stub(klass).validate_option { true }
|
| 388 | 388 |
end |
| 389 | 389 |
|
| 390 |
- post :validate, @params |
|
| 390 |
+ post :validate, params: @params |
|
| 391 | 391 |
expect(response.status).to eq 200 |
| 392 | 392 |
end |
| 393 | 393 |
|
@@ -396,7 +396,7 @@ describe AgentsController do |
||
| 396 | 396 |
stub(klass).validate_option { false }
|
| 397 | 397 |
end |
| 398 | 398 |
|
| 399 |
- post :validate, @params |
|
| 399 |
+ post :validate, params: @params |
|
| 400 | 400 |
expect(response.status).to eq 403 |
| 401 | 401 |
end |
| 402 | 402 |
end |
@@ -407,7 +407,7 @@ describe AgentsController do |
||
| 407 | 407 |
stub(klass).complete_option { [{name: 'test', value: 1}] }
|
| 408 | 408 |
end |
| 409 | 409 |
|
| 410 |
- post :complete, @params |
|
| 410 |
+ post :complete, params: @params |
|
| 411 | 411 |
expect(response.status).to eq 200 |
| 412 | 412 |
expect(response.header['Content-Type']).to include('application/json')
|
| 413 | 413 |
|
@@ -420,7 +420,7 @@ describe AgentsController do |
||
| 420 | 420 |
agent = agents(:bob_website_agent) |
| 421 | 421 |
agent.update!(memory: { "test" => 42 })
|
| 422 | 422 |
sign_in users(:bob) |
| 423 |
- delete :destroy_memory, id: agent.to_param |
|
| 423 |
+ delete :destroy_memory, params: {id: agent.to_param}
|
|
| 424 | 424 |
expect(agent.reload.memory).to eq({})
|
| 425 | 425 |
end |
| 426 | 426 |
|
@@ -429,7 +429,7 @@ describe AgentsController do |
||
| 429 | 429 |
agent.update!(memory: { "test" => 42 })
|
| 430 | 430 |
sign_in users(:bob) |
| 431 | 431 |
expect {
|
| 432 |
- delete :destroy_memory, id: agent.to_param |
|
| 432 |
+ delete :destroy_memory, params: {id: agent.to_param}
|
|
| 433 | 433 |
}.to raise_error(ActiveRecord::RecordNotFound) |
| 434 | 434 |
expect(agent.reload.memory).to eq({ "test" => 42})
|
| 435 | 435 |
end |
@@ -15,12 +15,12 @@ describe EventsController do |
||
| 15 | 15 |
|
| 16 | 16 |
it "can filter by Agent" do |
| 17 | 17 |
sign_in users(:bob) |
| 18 |
- get :index, :agent_id => agents(:bob_website_agent) |
|
| 18 |
+ get :index, params: {:agent_id => agents(:bob_website_agent)}
|
|
| 19 | 19 |
expect(assigns(:events).length).to eq(agents(:bob_website_agent).events.length) |
| 20 | 20 |
expect(assigns(:events).all? {|i| expect(i.agent).to eq(agents(:bob_website_agent)) }).to be_truthy
|
| 21 | 21 |
|
| 22 | 22 |
expect {
|
| 23 |
- get :index, :agent_id => agents(:jane_website_agent) |
|
| 23 |
+ get :index, params: {:agent_id => agents(:jane_website_agent)}
|
|
| 24 | 24 |
}.to raise_error(ActiveRecord::RecordNotFound) |
| 25 | 25 |
end |
| 26 | 26 |
end |
@@ -28,11 +28,11 @@ describe EventsController do |
||
| 28 | 28 |
describe "GET show" do |
| 29 | 29 |
it "only shows Events for the current user" do |
| 30 | 30 |
sign_in users(:bob) |
| 31 |
- get :show, :id => events(:bob_website_agent_event).to_param |
|
| 31 |
+ get :show, params: {:id => events(:bob_website_agent_event).to_param}
|
|
| 32 | 32 |
expect(assigns(:event)).to eq(events(:bob_website_agent_event)) |
| 33 | 33 |
|
| 34 | 34 |
expect {
|
| 35 |
- get :show, :id => events(:jane_website_agent_event).to_param |
|
| 35 |
+ get :show, params: {:id => events(:jane_website_agent_event).to_param}
|
|
| 36 | 36 |
}.to raise_error(ActiveRecord::RecordNotFound) |
| 37 | 37 |
end |
| 38 | 38 |
end |
@@ -45,7 +45,7 @@ describe EventsController do |
||
| 45 | 45 |
|
| 46 | 46 |
it "clones and re-emits events" do |
| 47 | 47 |
expect {
|
| 48 |
- post :reemit, :id => events(:bob_website_agent_event).to_param |
|
| 48 |
+ post :reemit, params: {:id => events(:bob_website_agent_event).to_param}
|
|
| 49 | 49 |
}.to change { Event.count }.by(1)
|
| 50 | 50 |
expect(Event.last.payload).to eq(events(:bob_website_agent_event).payload) |
| 51 | 51 |
expect(Event.last.agent).to eq(events(:bob_website_agent_event).agent) |
@@ -54,7 +54,7 @@ describe EventsController do |
||
| 54 | 54 |
|
| 55 | 55 |
it "can only re-emit Events for the current user" do |
| 56 | 56 |
expect {
|
| 57 |
- post :reemit, :id => events(:jane_website_agent_event).to_param |
|
| 57 |
+ post :reemit, params: {:id => events(:jane_website_agent_event).to_param}
|
|
| 58 | 58 |
}.to raise_error(ActiveRecord::RecordNotFound) |
| 59 | 59 |
end |
| 60 | 60 |
end |
@@ -63,11 +63,11 @@ describe EventsController do |
||
| 63 | 63 |
it "only deletes events for the current user" do |
| 64 | 64 |
sign_in users(:bob) |
| 65 | 65 |
expect {
|
| 66 |
- delete :destroy, :id => events(:bob_website_agent_event).to_param |
|
| 66 |
+ delete :destroy, params: {:id => events(:bob_website_agent_event).to_param}
|
|
| 67 | 67 |
}.to change { Event.count }.by(-1)
|
| 68 | 68 |
|
| 69 | 69 |
expect {
|
| 70 |
- delete :destroy, :id => events(:jane_website_agent_event).to_param |
|
| 70 |
+ delete :destroy, params: {:id => events(:jane_website_agent_event).to_param}
|
|
| 71 | 71 |
}.to raise_error(ActiveRecord::RecordNotFound) |
| 72 | 72 |
end |
| 73 | 73 |
end |
@@ -37,11 +37,11 @@ describe JobsController do |
||
| 37 | 37 |
end |
| 38 | 38 |
|
| 39 | 39 |
it "destroy a job which is not running" do |
| 40 |
- expect { delete :destroy, id: @not_running.id }.to change(Delayed::Job, :count).by(-1)
|
|
| 40 |
+ expect { delete :destroy, params: {id: @not_running.id} }.to change(Delayed::Job, :count).by(-1)
|
|
| 41 | 41 |
end |
| 42 | 42 |
|
| 43 | 43 |
it "does not destroy a running job" do |
| 44 |
- expect { delete :destroy, id: @running.id }.to change(Delayed::Job, :count).by(0)
|
|
| 44 |
+ expect { delete :destroy, params: {id: @running.id} }.to change(Delayed::Job, :count).by(0)
|
|
| 45 | 45 |
end |
| 46 | 46 |
end |
| 47 | 47 |
|
@@ -54,15 +54,15 @@ describe JobsController do |
||
| 54 | 54 |
end |
| 55 | 55 |
|
| 56 | 56 |
it "queue a job which is not running" do |
| 57 |
- expect { put :run, id: @not_running.id }.to change { @not_running.reload.run_at }
|
|
| 57 |
+ expect { put :run, params: {id: @not_running.id} }.to change { @not_running.reload.run_at }
|
|
| 58 | 58 |
end |
| 59 | 59 |
|
| 60 | 60 |
it "queue a job that failed" do |
| 61 |
- expect { put :run, id: @failed.id }.to change { @failed.reload.run_at }
|
|
| 61 |
+ expect { put :run, params: {id: @failed.id} }.to change { @failed.reload.run_at }
|
|
| 62 | 62 |
end |
| 63 | 63 |
|
| 64 | 64 |
it "not queue a running job" do |
| 65 |
- expect { put :run, id: @running.id }.not_to change { @not_running.reload.run_at }
|
|
| 65 |
+ expect { put :run, params: {id: @running.id} }.not_to change { @not_running.reload.run_at }
|
|
| 66 | 66 |
end |
| 67 | 67 |
end |
| 68 | 68 |
|
@@ -4,7 +4,7 @@ describe LogsController do |
||
| 4 | 4 |
describe "GET index" do |
| 5 | 5 |
it "can filter by Agent" do |
| 6 | 6 |
sign_in users(:bob) |
| 7 |
- get :index, :agent_id => agents(:bob_weather_agent).id |
|
| 7 |
+ get :index, params: {:agent_id => agents(:bob_weather_agent).id}
|
|
| 8 | 8 |
expect(assigns(:logs).length).to eq(agents(:bob_weather_agent).logs.length) |
| 9 | 9 |
expect(assigns(:logs).all? {|i| expect(i.agent).to eq(agents(:bob_weather_agent)) }).to be_truthy
|
| 10 | 10 |
end |
@@ -12,7 +12,7 @@ describe LogsController do |
||
| 12 | 12 |
it "only loads Agents owned by the current user" do |
| 13 | 13 |
sign_in users(:bob) |
| 14 | 14 |
expect {
|
| 15 |
- get :index, :agent_id => agents(:jane_weather_agent).id |
|
| 15 |
+ get :index, params: {:agent_id => agents(:jane_weather_agent).id}
|
|
| 16 | 16 |
}.to raise_error(ActiveRecord::RecordNotFound) |
| 17 | 17 |
end |
| 18 | 18 |
end |
@@ -22,7 +22,7 @@ describe LogsController do |
||
| 22 | 22 |
agents(:bob_weather_agent).last_error_log_at = 2.hours.ago |
| 23 | 23 |
sign_in users(:bob) |
| 24 | 24 |
expect {
|
| 25 |
- delete :clear, :agent_id => agents(:bob_weather_agent).id |
|
| 25 |
+ delete :clear, params: {:agent_id => agents(:bob_weather_agent).id}
|
|
| 26 | 26 |
}.to change { AgentLog.count }.by(-1 * agents(:bob_weather_agent).logs.count)
|
| 27 | 27 |
expect(assigns(:logs).length).to eq(0) |
| 28 | 28 |
expect(agents(:bob_weather_agent).reload.logs.count).to eq(0) |
@@ -32,7 +32,7 @@ describe LogsController do |
||
| 32 | 32 |
it "only deletes logs for an Agent owned by the current user" do |
| 33 | 33 |
sign_in users(:bob) |
| 34 | 34 |
expect {
|
| 35 |
- delete :clear, :agent_id => agents(:jane_weather_agent).id |
|
| 35 |
+ delete :clear, params: {:agent_id => agents(:jane_weather_agent).id}
|
|
| 36 | 36 |
}.to raise_error(ActiveRecord::RecordNotFound) |
| 37 | 37 |
end |
| 38 | 38 |
end |
@@ -15,7 +15,7 @@ describe ScenarioImportsController do |
||
| 15 | 15 |
|
| 16 | 16 |
describe "POST create" do |
| 17 | 17 |
it "initializes a ScenarioImport for current_user, passing in params" do |
| 18 |
- post :create, :scenario_import => { :url => "bad url" }
|
|
| 18 |
+ post :create, params: {:scenario_import => { :url => "bad url" }}
|
|
| 19 | 19 |
expect(assigns(:scenario_import).user).to eq(users(:bob)) |
| 20 | 20 |
expect(assigns(:scenario_import).url).to eq("bad url")
|
| 21 | 21 |
expect(assigns(:scenario_import)).not_to be_valid |
@@ -18,34 +18,34 @@ describe ScenariosController do |
||
| 18 | 18 |
|
| 19 | 19 |
describe "GET show" do |
| 20 | 20 |
it "only shows Scenarios for the current user" do |
| 21 |
- get :show, :id => scenarios(:bob_weather).to_param |
|
| 21 |
+ get :show, params: {:id => scenarios(:bob_weather).to_param}
|
|
| 22 | 22 |
expect(assigns(:scenario)).to eq(scenarios(:bob_weather)) |
| 23 | 23 |
|
| 24 | 24 |
expect {
|
| 25 |
- get :show, :id => scenarios(:jane_weather).to_param |
|
| 25 |
+ get :show, params: {:id => scenarios(:jane_weather).to_param}
|
|
| 26 | 26 |
}.to raise_error(ActiveRecord::RecordNotFound) |
| 27 | 27 |
end |
| 28 | 28 |
|
| 29 | 29 |
it "loads Agents for the requested Scenario" do |
| 30 |
- get :show, :id => scenarios(:bob_weather).to_param |
|
| 30 |
+ get :show, params: {:id => scenarios(:bob_weather).to_param}
|
|
| 31 | 31 |
expect(assigns(:agents).pluck(:id).sort).to eq(scenarios(:bob_weather).agents.pluck(:id).sort) |
| 32 | 32 |
end |
| 33 | 33 |
end |
| 34 | 34 |
|
| 35 | 35 |
describe "GET share" do |
| 36 | 36 |
it "only displays Scenario share information for the current user" do |
| 37 |
- get :share, :id => scenarios(:bob_weather).to_param |
|
| 37 |
+ get :share, params: {:id => scenarios(:bob_weather).to_param}
|
|
| 38 | 38 |
expect(assigns(:scenario)).to eq(scenarios(:bob_weather)) |
| 39 | 39 |
|
| 40 | 40 |
expect {
|
| 41 |
- get :share, :id => scenarios(:jane_weather).to_param |
|
| 41 |
+ get :share, params: {:id => scenarios(:jane_weather).to_param}
|
|
| 42 | 42 |
}.to raise_error(ActiveRecord::RecordNotFound) |
| 43 | 43 |
end |
| 44 | 44 |
end |
| 45 | 45 |
|
| 46 | 46 |
describe "GET export" do |
| 47 | 47 |
it "returns a JSON file download from an instantiated AgentsExporter" do |
| 48 |
- get :export, :id => scenarios(:bob_weather).to_param |
|
| 48 |
+ get :export, params: {:id => scenarios(:bob_weather).to_param}
|
|
| 49 | 49 |
expect(assigns(:exporter).options[:name]).to eq(scenarios(:bob_weather).name) |
| 50 | 50 |
expect(assigns(:exporter).options[:description]).to eq(scenarios(:bob_weather).description) |
| 51 | 51 |
expect(assigns(:exporter).options[:agents]).to eq(scenarios(:bob_weather).agents) |
@@ -59,11 +59,11 @@ describe ScenariosController do |
||
| 59 | 59 |
end |
| 60 | 60 |
|
| 61 | 61 |
it "only exports private Scenarios for the current user" do |
| 62 |
- get :export, :id => scenarios(:bob_weather).to_param |
|
| 62 |
+ get :export, params: {:id => scenarios(:bob_weather).to_param}
|
|
| 63 | 63 |
expect(assigns(:scenario)).to eq(scenarios(:bob_weather)) |
| 64 | 64 |
|
| 65 | 65 |
expect {
|
| 66 |
- get :export, :id => scenarios(:jane_weather).to_param |
|
| 66 |
+ get :export, params: {:id => scenarios(:jane_weather).to_param}
|
|
| 67 | 67 |
}.to raise_error(ActiveRecord::RecordNotFound) |
| 68 | 68 |
end |
| 69 | 69 |
|
@@ -73,14 +73,14 @@ describe ScenariosController do |
||
| 73 | 73 |
end |
| 74 | 74 |
|
| 75 | 75 |
it "exports public scenarios for other users when logged in" do |
| 76 |
- get :export, :id => scenarios(:jane_weather).to_param |
|
| 76 |
+ get :export, params: {:id => scenarios(:jane_weather).to_param}
|
|
| 77 | 77 |
expect(assigns(:scenario)).to eq(scenarios(:jane_weather)) |
| 78 | 78 |
expect(assigns(:exporter).options[:source_url]).to eq(export_scenario_url(scenarios(:jane_weather))) |
| 79 | 79 |
end |
| 80 | 80 |
|
| 81 | 81 |
it "exports public scenarios for other users when logged out" do |
| 82 | 82 |
sign_out :user |
| 83 |
- get :export, :id => scenarios(:jane_weather).to_param |
|
| 83 |
+ get :export, params: {:id => scenarios(:jane_weather).to_param}
|
|
| 84 | 84 |
expect(assigns(:scenario)).to eq(scenarios(:jane_weather)) |
| 85 | 85 |
expect(assigns(:exporter).options[:source_url]).to eq(export_scenario_url(scenarios(:jane_weather))) |
| 86 | 86 |
end |
@@ -89,11 +89,11 @@ describe ScenariosController do |
||
| 89 | 89 |
|
| 90 | 90 |
describe "GET edit" do |
| 91 | 91 |
it "only shows Scenarios for the current user" do |
| 92 |
- get :edit, :id => scenarios(:bob_weather).to_param |
|
| 92 |
+ get :edit, params: {:id => scenarios(:bob_weather).to_param}
|
|
| 93 | 93 |
expect(assigns(:scenario)).to eq(scenarios(:bob_weather)) |
| 94 | 94 |
|
| 95 | 95 |
expect {
|
| 96 |
- get :edit, :id => scenarios(:jane_weather).to_param |
|
| 96 |
+ get :edit, params: {:id => scenarios(:jane_weather).to_param}
|
|
| 97 | 97 |
}.to raise_error(ActiveRecord::RecordNotFound) |
| 98 | 98 |
end |
| 99 | 99 |
end |
@@ -101,13 +101,13 @@ describe ScenariosController do |
||
| 101 | 101 |
describe "POST create" do |
| 102 | 102 |
it "creates Scenarios for the current user" do |
| 103 | 103 |
expect {
|
| 104 |
- post :create, :scenario => valid_attributes |
|
| 104 |
+ post :create, params: {:scenario => valid_attributes}
|
|
| 105 | 105 |
}.to change { users(:bob).scenarios.count }.by(1)
|
| 106 | 106 |
end |
| 107 | 107 |
|
| 108 | 108 |
it "shows errors" do |
| 109 | 109 |
expect {
|
| 110 |
- post :create, :scenario => valid_attributes(:name => "") |
|
| 110 |
+ post :create, params: {:scenario => valid_attributes(:name => "")}
|
|
| 111 | 111 |
}.not_to change { users(:bob).scenarios.count }
|
| 112 | 112 |
expect(assigns(:scenario)).to have(1).errors_on(:name) |
| 113 | 113 |
expect(response).to render_template("new")
|
@@ -115,41 +115,41 @@ describe ScenariosController do |
||
| 115 | 115 |
|
| 116 | 116 |
it "will not create Scenarios for other users" do |
| 117 | 117 |
expect {
|
| 118 |
- post :create, :scenario => valid_attributes(:user_id => users(:jane).id) |
|
| 118 |
+ post :create, params: {:scenario => valid_attributes(:user_id => users(:jane).id)}
|
|
| 119 | 119 |
}.to raise_error(ActionController::UnpermittedParameters) |
| 120 | 120 |
end |
| 121 | 121 |
end |
| 122 | 122 |
|
| 123 | 123 |
describe "PUT update" do |
| 124 | 124 |
it "updates attributes on Scenarios for the current user" do |
| 125 |
- post :update, :id => scenarios(:bob_weather).to_param, :scenario => { :name => "new_name", :public => "1" }
|
|
| 125 |
+ post :update, params: {:id => scenarios(:bob_weather).to_param, :scenario => { :name => "new_name", :public => "1" }}
|
|
| 126 | 126 |
expect(response).to redirect_to(scenario_path(scenarios(:bob_weather))) |
| 127 | 127 |
expect(scenarios(:bob_weather).reload.name).to eq("new_name")
|
| 128 | 128 |
expect(scenarios(:bob_weather)).to be_public |
| 129 | 129 |
|
| 130 | 130 |
expect {
|
| 131 |
- post :update, :id => scenarios(:jane_weather).to_param, :scenario => { :name => "new_name" }
|
|
| 131 |
+ post :update, params: {:id => scenarios(:jane_weather).to_param, :scenario => { :name => "new_name" }}
|
|
| 132 | 132 |
}.to raise_error(ActiveRecord::RecordNotFound) |
| 133 | 133 |
expect(scenarios(:jane_weather).reload.name).not_to eq("new_name")
|
| 134 | 134 |
end |
| 135 | 135 |
|
| 136 | 136 |
it "shows errors" do |
| 137 |
- post :update, :id => scenarios(:bob_weather).to_param, :scenario => { :name => "" }
|
|
| 137 |
+ post :update, params: {:id => scenarios(:bob_weather).to_param, :scenario => { :name => "" }}
|
|
| 138 | 138 |
expect(assigns(:scenario)).to have(1).errors_on(:name) |
| 139 | 139 |
expect(response).to render_template("edit")
|
| 140 | 140 |
end |
| 141 | 141 |
|
| 142 | 142 |
it 'adds an agent to the scenario' do |
| 143 | 143 |
expect {
|
| 144 |
- post :update, :id => scenarios(:bob_weather).to_param, :scenario => { :name => "new_name", :public => "1", agent_ids: scenarios(:bob_weather).agent_ids + [agents(:bob_website_agent).id] }
|
|
| 145 |
- }.to change { scenarios(:bob_weather).agent_ids.length }.by(1)
|
|
| 144 |
+ post :update, params: {:id => scenarios(:bob_weather).to_param, :scenario => { :name => "new_name", :public => "1", agent_ids: scenarios(:bob_weather).agent_ids + [agents(:bob_website_agent).id] }}
|
|
| 145 |
+ }.to change { scenarios(:bob_weather).reload.agent_ids.length }.by(1)
|
|
| 146 | 146 |
end |
| 147 | 147 |
end |
| 148 | 148 |
|
| 149 | 149 |
describe 'PUT enable_or_disable_all_agents' do |
| 150 | 150 |
it 'updates disabled on all agents in a scenario for the current user' do |
| 151 | 151 |
@params = {"scenario"=>{"disabled"=>"true"}, "commit"=>"Yes", "id"=> scenarios(:bob_weather).id}
|
| 152 |
- put :enable_or_disable_all_agents, @params |
|
| 152 |
+ put :enable_or_disable_all_agents, params: @params |
|
| 153 | 153 |
expect(agents(:bob_rain_notifier_agent).disabled).to eq(true) |
| 154 | 154 |
expect(response).to redirect_to(scenario_path(scenarios(:bob_weather))) |
| 155 | 155 |
end |
@@ -158,17 +158,17 @@ describe ScenariosController do |
||
| 158 | 158 |
describe "DELETE destroy" do |
| 159 | 159 |
it "destroys only Scenarios owned by the current user" do |
| 160 | 160 |
expect {
|
| 161 |
- delete :destroy, :id => scenarios(:bob_weather).to_param |
|
| 161 |
+ delete :destroy, params: {:id => scenarios(:bob_weather).to_param}
|
|
| 162 | 162 |
}.to change(Scenario, :count).by(-1) |
| 163 | 163 |
|
| 164 | 164 |
expect {
|
| 165 |
- delete :destroy, :id => scenarios(:jane_weather).to_param |
|
| 165 |
+ delete :destroy, params: {:id => scenarios(:jane_weather).to_param}
|
|
| 166 | 166 |
}.to raise_error(ActiveRecord::RecordNotFound) |
| 167 | 167 |
end |
| 168 | 168 |
|
| 169 | 169 |
it "passes the mode to the model" do |
| 170 | 170 |
expect {
|
| 171 |
- delete :destroy, id: scenarios(:bob_weather).to_param, mode: 'all_agents' |
|
| 171 |
+ delete :destroy, params: {id: scenarios(:bob_weather).to_param, mode: 'all_agents'}
|
|
| 172 | 172 |
}.to change(Agent, :count).by(-2) |
| 173 | 173 |
end |
| 174 | 174 |
end |
@@ -14,14 +14,14 @@ describe ServicesController do |
||
| 14 | 14 |
|
| 15 | 15 |
describe "POST toggle_availability" do |
| 16 | 16 |
it "should work for service of the user" do |
| 17 |
- post :toggle_availability, :id => services(:generic).to_param |
|
| 17 |
+ post :toggle_availability, params: {:id => services(:generic).to_param}
|
|
| 18 | 18 |
expect(assigns(:service)).to eq(services(:generic)) |
| 19 | 19 |
redirect_to(services_path) |
| 20 | 20 |
end |
| 21 | 21 |
|
| 22 | 22 |
it "should not work for a service of another user" do |
| 23 | 23 |
expect {
|
| 24 |
- post :toggle_availability, :id => services(:global).to_param |
|
| 24 |
+ post :toggle_availability, params: {:id => services(:global).to_param}
|
|
| 25 | 25 |
}.to raise_error(ActiveRecord::RecordNotFound) |
| 26 | 26 |
end |
| 27 | 27 |
end |
@@ -29,11 +29,11 @@ describe ServicesController do |
||
| 29 | 29 |
describe "DELETE destroy" do |
| 30 | 30 |
it "destroys only services owned by the current user" do |
| 31 | 31 |
expect {
|
| 32 |
- delete :destroy, :id => services(:generic).to_param |
|
| 32 |
+ delete :destroy, params: {:id => services(:generic).to_param}
|
|
| 33 | 33 |
}.to change(Service, :count).by(-1) |
| 34 | 34 |
|
| 35 | 35 |
expect {
|
| 36 |
- delete :destroy, :id => services(:global).to_param |
|
| 36 |
+ delete :destroy, params: {:id => services(:global).to_param}
|
|
| 37 | 37 |
}.to raise_error(ActiveRecord::RecordNotFound) |
| 38 | 38 |
end |
| 39 | 39 |
end |
@@ -22,30 +22,30 @@ describe UserCredentialsController do |
||
| 22 | 22 |
|
| 23 | 23 |
describe "GET edit" do |
| 24 | 24 |
it "only shows UserCredentials for the current user" do |
| 25 |
- get :edit, :id => user_credentials(:bob_aws_secret).to_param |
|
| 25 |
+ get :edit, params: {:id => user_credentials(:bob_aws_secret).to_param}
|
|
| 26 | 26 |
expect(assigns(:user_credential)).to eq(user_credentials(:bob_aws_secret)) |
| 27 | 27 |
|
| 28 | 28 |
expect {
|
| 29 |
- get :edit, :id => user_credentials(:jane_aws_secret).to_param |
|
| 29 |
+ get :edit, params: {:id => user_credentials(:jane_aws_secret).to_param}
|
|
| 30 | 30 |
}.to raise_error(ActiveRecord::RecordNotFound) |
| 31 | 31 |
end |
| 32 | 32 |
end |
| 33 | 33 |
|
| 34 | 34 |
describe "Post import" do |
| 35 | 35 |
it "asserts user credentials were created for current user only" do |
| 36 |
- post :import, :file => @file |
|
| 36 |
+ post :import, params: {:file => @file}
|
|
| 37 | 37 |
expect(controller.current_user.id).to eq(users(:bob).id) |
| 38 | 38 |
expect(controller.current_user.user_credentials).to eq(users(:bob).user_credentials) |
| 39 | 39 |
end |
| 40 | 40 |
|
| 41 | 41 |
it "asserts that primary id in json file is ignored" do |
| 42 |
- post :import, :file => @file |
|
| 42 |
+ post :import, params: {:file => @file}
|
|
| 43 | 43 |
expect(controller.current_user.user_credentials.last.id).not_to eq(24) |
| 44 | 44 |
end |
| 45 | 45 |
|
| 46 | 46 |
it "duplicate credential name shows an error that it is not saved" do |
| 47 | 47 |
file1 = fixture_file_upload('multiple_user_credentials.json')
|
| 48 |
- post :import, :file => file1 |
|
| 48 |
+ post :import, params: {:file => file1}
|
|
| 49 | 49 |
expect(flash[:notice]).to eq("One or more of the uploaded credentials was not imported due to an error. Perhaps an existing credential had the same name?")
|
| 50 | 50 |
expect(response).to redirect_to(user_credentials_path) |
| 51 | 51 |
end |
@@ -54,13 +54,13 @@ describe UserCredentialsController do |
||
| 54 | 54 |
describe "POST create" do |
| 55 | 55 |
it "creates UserCredentials for the current user" do |
| 56 | 56 |
expect {
|
| 57 |
- post :create, :user_credential => valid_attributes |
|
| 57 |
+ post :create, params: {:user_credential => valid_attributes}
|
|
| 58 | 58 |
}.to change { users(:bob).user_credentials.count }.by(1)
|
| 59 | 59 |
end |
| 60 | 60 |
|
| 61 | 61 |
it "shows errors" do |
| 62 | 62 |
expect {
|
| 63 |
- post :create, :user_credential => valid_attributes(:credential_name => "") |
|
| 63 |
+ post :create, params: {:user_credential => valid_attributes(:credential_name => "")}
|
|
| 64 | 64 |
}.not_to change { users(:bob).user_credentials.count }
|
| 65 | 65 |
expect(assigns(:user_credential)).to have(1).errors_on(:credential_name) |
| 66 | 66 |
expect(response).to render_template("new")
|
@@ -68,25 +68,25 @@ describe UserCredentialsController do |
||
| 68 | 68 |
|
| 69 | 69 |
it "will not create UserCredentials for other users" do |
| 70 | 70 |
expect {
|
| 71 |
- post :create, :user_credential => valid_attributes(:user_id => users(:jane).id) |
|
| 71 |
+ post :create, params: {:user_credential => valid_attributes(:user_id => users(:jane).id)}
|
|
| 72 | 72 |
}.to raise_error(ActionController::UnpermittedParameters) |
| 73 | 73 |
end |
| 74 | 74 |
end |
| 75 | 75 |
|
| 76 | 76 |
describe "PUT update" do |
| 77 | 77 |
it "updates attributes on UserCredentials for the current user" do |
| 78 |
- post :update, :id => user_credentials(:bob_aws_key).to_param, :user_credential => { :credential_name => "new_name" }
|
|
| 78 |
+ post :update, params: {:id => user_credentials(:bob_aws_key).to_param, :user_credential => { :credential_name => "new_name" }}
|
|
| 79 | 79 |
expect(response).to redirect_to(user_credentials_path) |
| 80 | 80 |
expect(user_credentials(:bob_aws_key).reload.credential_name).to eq("new_name")
|
| 81 | 81 |
|
| 82 | 82 |
expect {
|
| 83 |
- post :update, :id => user_credentials(:jane_aws_key).to_param, :user_credential => { :credential_name => "new_name" }
|
|
| 83 |
+ post :update, params: {:id => user_credentials(:jane_aws_key).to_param, :user_credential => { :credential_name => "new_name" }}
|
|
| 84 | 84 |
}.to raise_error(ActiveRecord::RecordNotFound) |
| 85 | 85 |
expect(user_credentials(:jane_aws_key).reload.credential_name).not_to eq("new_name")
|
| 86 | 86 |
end |
| 87 | 87 |
|
| 88 | 88 |
it "shows errors" do |
| 89 |
- post :update, :id => user_credentials(:bob_aws_key).to_param, :user_credential => { :credential_name => "" }
|
|
| 89 |
+ post :update, params: {:id => user_credentials(:bob_aws_key).to_param, :user_credential => { :credential_name => "" }}
|
|
| 90 | 90 |
expect(assigns(:user_credential)).to have(1).errors_on(:credential_name) |
| 91 | 91 |
expect(response).to render_template("edit")
|
| 92 | 92 |
end |
@@ -95,11 +95,11 @@ describe UserCredentialsController do |
||
| 95 | 95 |
describe "DELETE destroy" do |
| 96 | 96 |
it "destroys only UserCredentials owned by the current user" do |
| 97 | 97 |
expect {
|
| 98 |
- delete :destroy, :id => user_credentials(:bob_aws_key).to_param |
|
| 98 |
+ delete :destroy, params: {:id => user_credentials(:bob_aws_key).to_param}
|
|
| 99 | 99 |
}.to change(UserCredential, :count).by(-1) |
| 100 | 100 |
|
| 101 | 101 |
expect {
|
| 102 |
- delete :destroy, :id => user_credentials(:jane_aws_key).to_param |
|
| 102 |
+ delete :destroy, params: {:id => user_credentials(:jane_aws_key).to_param}
|
|
| 103 | 103 |
}.to raise_error(ActiveRecord::RecordNotFound) |
| 104 | 104 |
end |
| 105 | 105 |
end |
@@ -2,8 +2,6 @@ require 'rails_helper' |
||
| 2 | 2 |
|
| 3 | 3 |
module Users |
| 4 | 4 |
describe RegistrationsController do |
| 5 |
- include Devise::TestHelpers |
|
| 6 |
- |
|
| 7 | 5 |
describe "POST create" do |
| 8 | 6 |
before do |
| 9 | 7 |
@request.env["devise.mapping"] = Devise.mappings[:user] |
@@ -13,8 +11,10 @@ module Users |
||
| 13 | 11 |
it "imports the default scenario for the new user" do |
| 14 | 12 |
mock(DefaultScenarioImporter).import(is_a(User)) |
| 15 | 13 |
|
| 16 |
- post :create, :user => {username: 'jdoe', email: 'jdoe@example.com',
|
|
| 17 |
- password: 's3cr3t55', password_confirmation: 's3cr3t55', invitation_code: 'try-huginn'} |
|
| 14 |
+ post :create, params: {
|
|
| 15 |
+ :user => {username: 'jdoe', email: 'jdoe@example.com',
|
|
| 16 |
+ password: 's3cr3t55', password_confirmation: 's3cr3t55', invitation_code: 'try-huginn'} |
|
| 17 |
+ } |
|
| 18 | 18 |
end |
| 19 | 19 |
end |
| 20 | 20 |
|
@@ -23,11 +23,11 @@ module Users |
||
| 23 | 23 |
stub(DefaultScenarioImporter).import(is_a(User)) { fail "Should not attempt import" }
|
| 24 | 24 |
|
| 25 | 25 |
setup_controller_for_warden |
| 26 |
- post :create, :user => {}
|
|
| 26 |
+ post :create, params: {:user => {}}
|
|
| 27 | 27 |
end |
| 28 | 28 |
|
| 29 | 29 |
it 'does not allow to set the admin flag' do |
| 30 |
- expect { post :create, :user => {admin: 'true'} }.to raise_error(ActionController::UnpermittedParameters)
|
|
| 30 |
+ expect { post :create, params: {:user => {admin: 'true'}} }.to raise_error(ActionController::UnpermittedParameters)
|
|
| 31 | 31 |
end |
| 32 | 32 |
end |
| 33 | 33 |
end |
@@ -26,14 +26,14 @@ describe WebRequestsController do |
||
| 26 | 26 |
|
| 27 | 27 |
it "should not require login to receive a web request" do |
| 28 | 28 |
expect(@agent.last_web_request_at).to be_nil |
| 29 |
- post :handle_request, :user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5" |
|
| 29 |
+ post :handle_request, params: {:user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5"}
|
|
| 30 | 30 |
expect(@agent.reload.last_web_request_at).to be_within(2).of(Time.now) |
| 31 | 31 |
expect(response.body).to eq("success")
|
| 32 | 32 |
expect(response).to be_success |
| 33 | 33 |
end |
| 34 | 34 |
|
| 35 | 35 |
it "should call receive_web_request" do |
| 36 |
- post :handle_request, :user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5" |
|
| 36 |
+ post :handle_request, params: {:user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5"}
|
|
| 37 | 37 |
@agent.reload |
| 38 | 38 |
expect(@agent.memory[:web_request_values]).to eq({ 'key' => "value", 'another_key' => "5" })
|
| 39 | 39 |
expect(@agent.memory[:web_request_format]).to eq("text/html")
|
@@ -42,14 +42,14 @@ describe WebRequestsController do |
||
| 42 | 42 |
expect(response.headers['Content-Type']).to eq('text/plain; charset=utf-8')
|
| 43 | 43 |
expect(response).to be_success |
| 44 | 44 |
|
| 45 |
- post :handle_request, :user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "not_my_secret", :no => "go" |
|
| 45 |
+ post :handle_request, params: {:user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "not_my_secret", :no => "go"}
|
|
| 46 | 46 |
expect(@agent.reload.memory[:web_request_values]).not_to eq({ 'no' => "go" })
|
| 47 | 47 |
expect(response.body).to eq("failure")
|
| 48 | 48 |
expect(response).to be_missing |
| 49 | 49 |
end |
| 50 | 50 |
|
| 51 | 51 |
it "should accept gets" do |
| 52 |
- get :handle_request, :user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5" |
|
| 52 |
+ get :handle_request, params: {:user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5"}
|
|
| 53 | 53 |
@agent.reload |
| 54 | 54 |
expect(@agent.memory[:web_request_values]).to eq({ 'key' => "value", 'another_key' => "5" })
|
| 55 | 55 |
expect(@agent.memory[:web_request_format]).to eq("text/html")
|
@@ -59,19 +59,19 @@ describe WebRequestsController do |
||
| 59 | 59 |
end |
| 60 | 60 |
|
| 61 | 61 |
it "should pass through the received format" do |
| 62 |
- get :handle_request, :user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5", :format => :json |
|
| 62 |
+ get :handle_request, params: {:user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5"}, :format => :json
|
|
| 63 | 63 |
@agent.reload |
| 64 | 64 |
expect(@agent.memory[:web_request_values]).to eq({ 'key' => "value", 'another_key' => "5" })
|
| 65 | 65 |
expect(@agent.memory[:web_request_format]).to eq("application/json")
|
| 66 | 66 |
expect(@agent.memory[:web_request_method]).to eq("get")
|
| 67 | 67 |
|
| 68 |
- post :handle_request, :user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5", :format => :xml |
|
| 68 |
+ post :handle_request, params: {:user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5"}, :format => :xml
|
|
| 69 | 69 |
@agent.reload |
| 70 | 70 |
expect(@agent.memory[:web_request_values]).to eq({ 'key' => "value", 'another_key' => "5" })
|
| 71 | 71 |
expect(@agent.memory[:web_request_format]).to eq("application/xml")
|
| 72 | 72 |
expect(@agent.memory[:web_request_method]).to eq("post")
|
| 73 | 73 |
|
| 74 |
- put :handle_request, :user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5", :format => :atom |
|
| 74 |
+ put :handle_request, params: {:user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5"}, :format => :atom
|
|
| 75 | 75 |
@agent.reload |
| 76 | 76 |
expect(@agent.memory[:web_request_values]).to eq({ 'key' => "value", 'another_key' => "5" })
|
| 77 | 77 |
expect(@agent.memory[:web_request_format]).to eq("application/atom+xml")
|
@@ -81,17 +81,17 @@ describe WebRequestsController do |
||
| 81 | 81 |
it "can accept a content-type to return" do |
| 82 | 82 |
@agent.memory['content_type'] = 'application/json' |
| 83 | 83 |
@agent.save! |
| 84 |
- get :handle_request, :user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5" |
|
| 84 |
+ get :handle_request, params: {:user_id => users(:bob).to_param, :agent_id => @agent.id, :secret => "my_secret", :key => "value", :another_key => "5"}
|
|
| 85 | 85 |
expect(response.headers['Content-Type']).to eq('application/json; charset=utf-8')
|
| 86 | 86 |
end |
| 87 | 87 |
|
| 88 | 88 |
it "should fail on incorrect users" do |
| 89 |
- post :handle_request, :user_id => users(:jane).to_param, :agent_id => @agent.id, :secret => "my_secret", :no => "go" |
|
| 89 |
+ post :handle_request, params: {:user_id => users(:jane).to_param, :agent_id => @agent.id, :secret => "my_secret", :no => "go"}
|
|
| 90 | 90 |
expect(response).to be_missing |
| 91 | 91 |
end |
| 92 | 92 |
|
| 93 | 93 |
it "should fail on incorrect agents" do |
| 94 |
- post :handle_request, :user_id => users(:bob).to_param, :agent_id => 454545, :secret => "my_secret", :no => "go" |
|
| 94 |
+ post :handle_request, params: {:user_id => users(:bob).to_param, :agent_id => 454545, :secret => "my_secret", :no => "go"}
|
|
| 95 | 95 |
expect(response).to be_missing |
| 96 | 96 |
end |
| 97 | 97 |
|
@@ -102,7 +102,7 @@ describe WebRequestsController do |
||
| 102 | 102 |
end |
| 103 | 103 |
|
| 104 | 104 |
it "should create events without requiring login" do |
| 105 |
- post :update_location, user_id: users(:bob).to_param, secret: "my_secret", longitude: 123, latitude: 45, something: "else" |
|
| 105 |
+ post :update_location, params: {user_id: users(:bob).to_param, secret: "my_secret", longitude: 123, latitude: 45, something: "else"}
|
|
| 106 | 106 |
expect(@agent.events.last.payload).to eq({ 'longitude' => "123", 'latitude' => "45", 'something' => "else" })
|
| 107 | 107 |
expect(@agent.events.last.lat).to eq(45) |
| 108 | 108 |
expect(@agent.events.last.lng).to eq(123) |
@@ -112,13 +112,13 @@ describe WebRequestsController do |
||
| 112 | 112 |
@jane_agent = Agent.build_for_type("Agents::UserLocationAgent", users(:jane), name: "something", options: { secret: "my_secret" })
|
| 113 | 113 |
@jane_agent.save! |
| 114 | 114 |
|
| 115 |
- post :update_location, user_id: users(:bob).to_param, secret: "my_secret", longitude: 123, latitude: 45, something: "else" |
|
| 115 |
+ post :update_location, params: {user_id: users(:bob).to_param, secret: "my_secret", longitude: 123, latitude: 45, something: "else"}
|
|
| 116 | 116 |
expect(@agent.events.last.payload).to eq({ 'longitude' => "123", 'latitude' => "45", 'something' => "else" })
|
| 117 | 117 |
expect(@jane_agent.events).to be_empty |
| 118 | 118 |
end |
| 119 | 119 |
|
| 120 | 120 |
it "should raise a 404 error when given an invalid user id" do |
| 121 |
- post :update_location, user_id: "123", secret: "not_my_secret", longitude: 123, latitude: 45, something: "else" |
|
| 121 |
+ post :update_location, params: {user_id: "123", secret: "not_my_secret", longitude: 123, latitude: 45, something: "else"}
|
|
| 122 | 122 |
expect(response).to be_missing |
| 123 | 123 |
end |
| 124 | 124 |
|
@@ -127,7 +127,7 @@ describe WebRequestsController do |
||
| 127 | 127 |
@agent2.save! |
| 128 | 128 |
|
| 129 | 129 |
expect {
|
| 130 |
- post :update_location, user_id: users(:bob).to_param, secret: "my_secret2", longitude: 123, latitude: 45, something: "else" |
|
| 130 |
+ post :update_location, params: {user_id: users(:bob).to_param, secret: "my_secret2", longitude: 123, latitude: 45, something: "else"}
|
|
| 131 | 131 |
expect(@agent2.events.last.payload).to eq({ 'longitude' => "123", 'latitude' => "45", 'something' => "else" })
|
| 132 | 132 |
}.not_to change { @agent.events.count }
|
| 133 | 133 |
end |
@@ -1,6 +1,7 @@ |
||
| 1 | 1 |
require 'rails_helper' |
| 2 | 2 |
|
| 3 | 3 |
describe "Dry running an Agent", js: true do |
| 4 |
+ let(:agent) { agents(:bob_website_agent) }
|
|
| 4 | 5 |
let(:formatting_agent) { agents(:bob_formatting_agent) }
|
| 5 | 6 |
let(:user) { users(:bob) }
|
| 6 | 7 |
let(:emitter) { agents(:bob_weather_agent) }
|
@@ -16,6 +17,35 @@ describe "Dry running an Agent", js: true do |
||
| 16 | 17 |
end |
| 17 | 18 |
|
| 18 | 19 |
context 'successful dry runs' do |
| 20 |
+ before do |
|
| 21 |
+ stub_request(:get, "http://xkcd.com/"). |
|
| 22 |
+ with(:headers => {'Accept-Encoding'=>'gzip,deflate', 'User-Agent'=>'Huginn - https://github.com/cantino/huginn'}).
|
|
| 23 |
+ to_return(:status => 200, :body => File.read(Rails.root.join("spec/data_fixtures/xkcd.html")), :headers => {})
|
|
| 24 |
+ end |
|
| 25 |
+ |
|
| 26 |
+ it 'shows the dry run pop up without previous events and selects the events tab when a event was created' do |
|
| 27 |
+ open_dry_run_modal(agent) |
|
| 28 |
+ click_on("Dry Run")
|
|
| 29 |
+ expect(page).to have_text('Biologists play reverse')
|
|
| 30 |
+ expect(page).to have_selector(:css, 'li[role="presentation"].active a[href="#tabEvents"]') |
|
| 31 |
+ end |
|
| 32 |
+ |
|
| 33 |
+ it 'shows the dry run pop up with previous events and allows use previously received event' do |
|
| 34 |
+ emitter.events << Event.new(payload: {url: "http://xkcd.com/"})
|
|
| 35 |
+ agent.sources << emitter |
|
| 36 |
+ agent.options.merge!('url' => '', 'url_from_event' => '{{url}}')
|
|
| 37 |
+ agent.save! |
|
| 38 |
+ |
|
| 39 |
+ open_dry_run_modal(agent) |
|
| 40 |
+ find('.dry-run-event-sample').click
|
|
| 41 |
+ within(:css, '.modal .builder') do |
|
| 42 |
+ expect(page).to have_text('http://xkcd.com/')
|
|
| 43 |
+ end |
|
| 44 |
+ click_on("Dry Run")
|
|
| 45 |
+ expect(page).to have_text('Biologists play reverse')
|
|
| 46 |
+ expect(page).to have_selector(:css, 'li[role="presentation"].active a[href="#tabEvents"]') |
|
| 47 |
+ end |
|
| 48 |
+ |
|
| 19 | 49 |
it 'sends escape characters correctly to the backend' do |
| 20 | 50 |
emitter.events << Event.new(payload: {data: "Line 1\nLine 2\nLine 3"})
|
| 21 | 51 |
formatting_agent.sources << emitter |
@@ -32,4 +62,15 @@ describe "Dry running an Agent", js: true do |
||
| 32 | 62 |
expect(page).to have_selector(:css, 'li[role="presentation"].active a[href="#tabEvents"]') |
| 33 | 63 |
end |
| 34 | 64 |
end |
| 65 |
+ |
|
| 66 |
+ it 'shows the dry run pop up without previous events and selects the log tab when no event was created' do |
|
| 67 |
+ stub_request(:get, "http://xkcd.com/"). |
|
| 68 |
+ with(:headers => {'Accept-Encoding'=>'gzip,deflate', 'User-Agent'=>'Huginn - https://github.com/cantino/huginn'}).
|
|
| 69 |
+ to_return(:status => 200, :body => "", :headers => {})
|
|
| 70 |
+ |
|
| 71 |
+ open_dry_run_modal(agent) |
|
| 72 |
+ click_on("Dry Run")
|
|
| 73 |
+ expect(page).to have_text('Dry Run started')
|
|
| 74 |
+ expect(page).to have_selector(:css, 'li[role="presentation"].active a[href="#tabLog"]') |
|
| 75 |
+ end |
|
| 35 | 76 |
end |
@@ -0,0 +1,46 @@ |
||
| 1 |
+require 'rails_helper' |
|
| 2 |
+ |
|
| 3 |
+describe ScenarioImportsController do |
|
| 4 |
+ let(:user) { users(:bob) }
|
|
| 5 |
+ |
|
| 6 |
+ before do |
|
| 7 |
+ login_as(user) |
|
| 8 |
+ end |
|
| 9 |
+ |
|
| 10 |
+ it 'renders the import form' do |
|
| 11 |
+ visit new_scenario_imports_path |
|
| 12 |
+ expect(page).to have_text('Import a Public Scenario')
|
|
| 13 |
+ end |
|
| 14 |
+ |
|
| 15 |
+ it 'requires a URL or file uplaod' do |
|
| 16 |
+ visit new_scenario_imports_path |
|
| 17 |
+ click_on 'Start Import' |
|
| 18 |
+ expect(page).to have_text('Please provide either a Scenario JSON File or a Public Scenario URL.')
|
|
| 19 |
+ end |
|
| 20 |
+ |
|
| 21 |
+ it 'imports a scenario that does not exist yet' do |
|
| 22 |
+ visit new_scenario_imports_path |
|
| 23 |
+ attach_file('Option 2: Upload a Scenario JSON File', File.join(Rails.root, 'data/default_scenario.json'))
|
|
| 24 |
+ click_on 'Start Import' |
|
| 25 |
+ expect(page).to have_text('This scenario has a few agents to get you started. Feel free to change them or delete them as you see fit!')
|
|
| 26 |
+ expect(page).not_to have_text('This Scenario already exists in your system.')
|
|
| 27 |
+ check('I confirm that I want to import these Agents.')
|
|
| 28 |
+ click_on 'Finish Import' |
|
| 29 |
+ expect(page).to have_text('Import successful!')
|
|
| 30 |
+ end |
|
| 31 |
+ |
|
| 32 |
+ it 'asks to accept conflicts when the scenario was modified' do |
|
| 33 |
+ DefaultScenarioImporter.seed(user) |
|
| 34 |
+ agent = user.agents.where(name: 'Rain Notifier').first |
|
| 35 |
+ agent.options['expected_receive_period_in_days'] = 9001 |
|
| 36 |
+ agent.save! |
|
| 37 |
+ visit new_scenario_imports_path |
|
| 38 |
+ attach_file('Option 2: Upload a Scenario JSON File', File.join(Rails.root, 'data/default_scenario.json'))
|
|
| 39 |
+ click_on 'Start Import' |
|
| 40 |
+ expect(page).to have_text('This Scenario already exists in your system.')
|
|
| 41 |
+ expect(page).to have_text('9001')
|
|
| 42 |
+ check('I confirm that I want to import these Agents.')
|
|
| 43 |
+ click_on 'Finish Import' |
|
| 44 |
+ expect(page).to have_text('Import successful!')
|
|
| 45 |
+ end |
|
| 46 |
+end |
@@ -144,8 +144,12 @@ bob_manual_event_agent: |
||
| 144 | 144 |
bob_basecamp_agent: |
| 145 | 145 |
type: Agents::BasecampAgent |
| 146 | 146 |
user: bob |
| 147 |
+ name: "bob basecamp agent" |
|
| 147 | 148 |
service: generic |
| 148 | 149 |
guid: <%= SecureRandom.hex %> |
| 150 |
+ options: <%= {
|
|
| 151 |
+ :project_id => "12345", |
|
| 152 |
+ }.to_json.inspect %> |
|
| 149 | 153 |
|
| 150 | 154 |
bob_csv_agent: |
| 151 | 155 |
type: Agents::CsvAgent |
@@ -156,8 +160,12 @@ bob_csv_agent: |
||
| 156 | 160 |
jane_basecamp_agent: |
| 157 | 161 |
type: Agents::BasecampAgent |
| 158 | 162 |
user: jane |
| 163 |
+ name: "jane basecamp agent" |
|
| 159 | 164 |
service: generic |
| 160 | 165 |
guid: <%= SecureRandom.hex %> |
| 166 |
+ options: <%= {
|
|
| 167 |
+ :project_id => "12345", |
|
| 168 |
+ }.to_json.inspect %> |
|
| 161 | 169 |
|
| 162 | 170 |
|
| 163 | 171 |
bob_data_output_agent: |
@@ -66,7 +66,7 @@ RSpec.configure do |config| |
||
| 66 | 66 |
|
| 67 | 67 |
config.render_views |
| 68 | 68 |
|
| 69 |
- config.include Devise::TestHelpers, type: :controller |
|
| 69 |
+ config.include Devise::Test::ControllerHelpers, type: :controller |
|
| 70 | 70 |
config.include SpecHelpers |
| 71 | 71 |
config.include Delorean |
| 72 | 72 |
end |